<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type" /><style><!--/*paged media */ div.header {display: none }div.footer {display: none } /*@media print { */@page { size: A4; margin: 10%; @top-center {content: element(header) } @bottom-center {content: element(footer) } }/*element styles*/ .del  {text-decoration:line-through;color:red;} .ins {text-decoration:none;background:#c0ffc0;padding:1px;}
 /* TABLE STYLES */ 
table.TableNormal {display:table;position: relative; margin-left: 0in;}
table.TableGrid {display:table;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;margin-bottom: 0in;line-height: 100%;}

 /* PARAGRAPH STYLES */ 
.DocDefaults {display:block;margin-bottom: 4mm;line-height: 115%;font-size: 11.0pt;}
.Normal {display:block;}
.NormalWeb {display:block;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;font-size: 12.0pt;}
.Command {display:block;position: relative; margin-left: 0.5in;font-size: 10.0pt;}
.FootnoteText {display:block;margin-bottom: 0in;line-height: 100%;font-size: 10.0pt;}
.Title {display:block;border-bottom-style: solid;border-bottom-width: 0.35mm;border-bottom-color: #4F81BD;margin-bottom: 0.21in;line-height: 100%;color: #17365D;letter-spacing: 0mm;font-size: 26.0pt;}
.Grammar {display:block;position: relative; margin-left: 0.75in;text-indent: -0.25in;margin-bottom: 0.08in;line-height: 104%;font-style: italic;}
.TOC2 {display:block;position: relative; margin-left: 4mm;margin-bottom: 0.07in;}
.Heading1 {display:block;page-break-after: avoid;margin-top: 0.33in;margin-bottom: 4mm;font-weight: bold;color: #365F91;font-size: 18.0pt;}
.TOCHeading {display:block;margin-bottom: 0in;font-size: 14.0pt;}
.TOC1 {display:block;margin-bottom: 0.07in;}
.Heading2 {display:block;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;font-weight: bold;font-style: italic;font-size: 14.0pt;}
.Header {display:block;margin-bottom: 0in;line-height: 100%;}
.ListParagraph {display:block;position: relative; margin-left: 0.5in;}
.Footer {display:block;margin-bottom: 0in;line-height: 100%;}
.Normal-TableGrid-BR {display:block;margin-bottom: 0in;line-height: 100%;font-size: 11.0pt;}
.ListParagraph-TableGrid-BR {display:block;position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;font-size: 11.0pt;}

 /* CHARACTER STYLES */ span.DefaultParagraphFont {display:inline;}
span.xmlmarkuptagname {display:inline;}
span.underline {display:inline;}
span.xmlmarkupattributename {display:inline;}
span.apple-style-span {display:inline;}
span.Strong {display:inline;font-weight: bold;}
span.Emphasis {display:inline;font-style: italic;}
span.FootnoteReference {display:inline;vertical-align: super;font-size: smaller;}
span.apple-converted-space {display:inline;}
span.HTMLCode {display:inline;font-size: 10.0pt;}
span.xmlmarkupbracket {display:inline;}
span.xmlmarkupattributevalue {display:inline;}
span.Hyperlink {display:inline;color: #0000FF;text-decoration: underline;}
span.Terminal {display:inline;font-style: italic;font-size: 10.0pt;}
html, body, div, span, h1, h2, h3, h4, h5, h6, p, a, img,  table, caption, tbody, tfoot, thead, tr, th, td { margin: 0; padding: 0; border: 0;}body {line-height: 1;} --></style><script type="text/javascript"><!--function toggleDiv(divid){if(document.getElementById(divid).style.display == 'none'){document.getElementById(divid).style.display = 'block';}else{document.getElementById(divid).style.display = 'none';}}
--></script></head><body>
  
  <!-- userBodyTop goes here -->
  
  
  
  <div class="document">
  
  <p class="Title Normal DocDefaults "><span class="" style="font-family: 'Liberation Serif';">Docx4j - Getting Started</span></p>
  
  <p class="TOCHeading Heading1 Normal DocDefaults "><span class="" style="font-family: 'Liberation Serif';">Contents</span></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591801"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">What is docx4j?</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591801"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591802"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">What sorts of things can you do with docx4j?</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591802"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591803"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Is docx4j for you?</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591803"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591804"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">GraalVM</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591804"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591805"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">docx4j.NET</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591805"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591806"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">What Word documents does it support?</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591806"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591807"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Handling legacy binary .doc files</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591807"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591808"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Getting Help: the docx4j forum</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591808"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591809"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">A word about Jaxb</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591809"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591810"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Using docx4j via Maven</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591810"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591811"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Using docx4j binaries</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591811"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591812"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">docx4j dependencies</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591812"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591813"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">slf4j</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591813"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591814"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">other dependencies</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591814"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591815"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Docx4j source code</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591815"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591816"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Javadoc</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591816"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591817"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Building docx4j from source</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591817"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591818"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Command line -via Maven</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591818"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591819"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Eclipse</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591819"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591820"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Using a different IDE?</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591820"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591821"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Open an existing docx/pptx/xlsx document</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591821"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591822"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">OpenXML concepts</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591822"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591823"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Specification versions</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591823"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591824"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Architecture</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591824"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591825"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Jaxb: marshalling and unmarshalling</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591825"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591826"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Parts List</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591826"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591827"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">MainDocumentPart</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591827"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591828"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Samples</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591828"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591829"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Creating a new docx</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591829"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591830"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">docx4j.properties</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591830"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591831"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Adding a paragraph of text</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591831"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591832"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">General strategy/approach for creating stuff</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591832"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591833"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Formatting Properties</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591833"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591834"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Creating and adding a table</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591834"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591835"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Selecting your insertion/editing point;  accessing JAXB nodes via XPath</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591835"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591836"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Traversing a document</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591836"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591837"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Adding a Part</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591837"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591838"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Importing XHTML</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591838"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591839"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">docx to (X)HTML</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591839"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591840"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">docx to PDF</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591840"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591841"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">docx/pptx/xlsx to PDF via Documents4j (using Word)</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591841"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591842"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">docx/pptx/xlsx to PDF via Microsoft Graph</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591842"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591843"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">docx to PDF via XSL FO</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591843"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591844"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Image Handling - DOCX</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591844"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591845"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Manual Image Manipulation</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591845"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591846"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Image Handling – PPTX</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591846"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591847"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Adding Headers/Footers</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591847"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591848"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Protection Settings</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591848"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591849"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">docx Table of Contents</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591849"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591850"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Introduction</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591850"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591851"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Field background</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591851"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591852"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">TOC Content Control</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591852"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591853"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">TOC Field Syntax</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591853"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591854"><span class="Hyperlink DefaultParagraphFont "><span class="" style="font-family: 'Calibri Light';">Inserting/generating a TOC </span><span class="" style="">– </span><span class="" style="font-family: 'Calibri Light';">"pure Java" considerations</span></span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591854"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591855"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Text extraction</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591855"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591856"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Text substitution</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591856"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591857"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Text substitution via data bound content controls</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591857"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591858"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Binding extensions for repeats and conditionals</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591858"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591859"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Binding escaped XHTML (XML + CSS)</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591859"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591860"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Binding other rich content</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591860"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591861"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Authoring</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591861"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591862"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Mailmerge</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591862"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591863"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">SmartArt</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591863"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591864"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">JAXB stuff</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591864"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591865"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Cloning</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591865"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591866"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">javax.xml.bind.JAXBElement</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591866"><span>1</span></a></a></p>
  
  <p class="TOC2 Normal DocDefaults "><a href="#_Toc96591867"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">@XmlRootElement</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591867"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591868"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Merging Documents and Presentations</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591868"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591869"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Other Support Options</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591869"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591870"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Colophon</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591870"><span>1</span></a></a></p>
  
  <p class="TOC1 Normal DocDefaults "><a href="#_Toc96591871"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Contacting Plutext</span><span class="DefaultParagraphFont ">   </span><a href="#_Toc96591871"><span>1</span></a></a></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;" /></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">This guide is for docx4j </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">8.3.3</span><span class="" style="font-family: 'Calibri Light';">.</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  The </span><span class="" style="font-family: 'Calibri Light';">8.x series will be the last series to run under Java 1.8</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> (hence the name). </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">There are 2 significant changes in docx4j 8.0.0:</span></p><ol>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">The project is now structured as a maven multi-module project</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">You'll need one and only one of the docx4j-JAXB-</span><span style="font-family: 'Calibri Light';">[Internal|MOXy|ReferenceImpl] artifacts and its deps</span></li></ol>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">The latest version of this document can always be found in </span><a href="https://github.com/plutext/docx4j/tree/master/docs"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">docx4j on GitHub in /docs</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /><span class="" style="font-family: 'Calibri Light';">.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">There is also a handy 1 page summary at </span><a href="https://www.docx4java.org/docx4j/plutext-docx4j_on_a_page-v300.pdf"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://www.docx4java.org/docx4j/plutext-docx4j_on_a_page-v300.pdf</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri Light';">(look out for an update soon).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">The most up to date copy of this document is in English.  </span><span class="" style="font-family: 'Calibri Light';">There is also an old now outdated</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> Russian version.  From time to time, it may be machine translated into other languages.  Please let us know if you are interested in writing some basic documentation in your own language (either as a contribution, or for a fee). </span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591801" /><span style="font-family: 'Liberation Serif';">What is docx4j?</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">docx4j is a library for </span><span class="" style="font-family: 'Calibri Light';">working with docx, pptx and xlsx files in Java.  In essence, it can unzip a</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> docx </span><span class="" style="font-family: 'Calibri Light';">(or pptx/xlsx) "package", and parse</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> the XML to create an in-memory representation in </span><span class="" style="font-family: 'Calibri Light';">Java</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> using developer friendly classes (as opposed to DOM or SAX).  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">docx4j is usually deployed as part of a web application (eg on Tomcat, JBOSS, WebSphere etc </span><span class="" style="">– </span><span class="" style="font-family: 'Calibri Light';">see the deployment forums).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">docx4j</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> is similar in concept to Microsoft's  OpenXML SDK, which is for .NET.  docx4j.NET is available for the NET platform; see further below.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">A distinctive strength of docx4j is that its in-memory representation uses </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">JAXB</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">, the JCP standard for Java - XML binding.  </span><span class="" style="font-family: 'Calibri Light';">Docx4j is the only library for working with OpenXML files which uses/supports JAXB (each of</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> the Sun/Oracle</span><span class="" style="font-family: 'Calibri Light';">,</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> MOXy </span><span class="" style="font-family: 'Calibri Light';">and IBM</span><span class="FootnoteReference DefaultParagraphFont " style="vertical-align: top; font-size: xx-small"><a name="fs1"><a href="#fn1">1</a></a></span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> implementations).  </span><span class="" style="font-family: 'Calibri Light';">In contrast, Apache POI uses XML Beans.</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  (Aspose in contrast, does not provide low-level access to the underlying XML or a corresponding object model, so "you can't do it" unless Aspose provides support for it).  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">docx4j is open source, available under the Apache License (v2).  As an open source project, docx4j has been substantially improved by a number of contributions (see the README or POM file for contributors), and further contributions are always welcome.  Please see the docx4j forum at </span><a href="http://www.docx4java.org/forums/"><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri Light';">http://</span><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri Light';">www.docx4java</span><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri Light';">.org/forums/</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> for details.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">The docx4j project is sponsored by Plutext (</span><a href="http://www.plutext.com"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">www.plutext.com</span></a><span class="" style="font-family: 'Calibri Light';">).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">There is also a commercial enterprise edition of docx4j, which comes with commercial support and additional functionality not found in the community edition.  Additional functionality includes:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Merging documents or presentations</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">OLE embedding of files in docx, pptx, xlsx</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Digital signatures</span></li></ul>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591802" /><span style="font-family: 'Liberation Serif';">What sorts of things can you do with docx4j?</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Open existing docx (from filesystem, SMB/CIFS, WebDAV using VFS), pptx, xlsx</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Create new docx, pptx, xlsx</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Programmatically manipulate the above (of course)</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Save to various media zipped, or unzipped</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Protection settings</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Produce/consume  the Flat OPC XML format</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Do all this on Android.</span></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Specific to docx4j (as opposed to pptx4j, xlsx4j):</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Import XHTML</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Export as (X)HTML or PDF</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Template substitution; CustomXML binding</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Mail merge</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Apply transforms, including common filters</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Diff/compare documents, paragraphs or sdt (content controls)</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Font support (font substitution, and use of any fonts embedded in the document)</span></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">This document focuses primarily on docx4j, but the general principles are equally applicable to pptx4j and xlsx4j.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591803" /><span style="font-family: 'Liberation Serif';">Is docx4j for you?</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Docx4j is for processing docx documents (and pptx presentations and xlsx spreadsheets) in Java.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">It isn't for old binary (.doc) files.  If you wish to invest your effort around docx (as is wise), but you also need to be able to handle old doc files, see further below for your options. </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Nor is it for RTF files.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591804" /><span style="font-family: 'Liberation Serif';">GraalVM</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Programs based on docx4j can be converted to a Graal native image, and run "serverless" on AWS Lambda.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591805" /><span style="font-family: 'Liberation Serif';">docx4j.NET</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">If you want to process docx/pptx/xslsx on the .NET platform, you should </span><span class="" style="font-family: 'Calibri Light';">consider</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> Microsoft's </span><span class="" style="font-family: 'Calibri Light';">OpenXML SDK.</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  That said, docx4j can be used in a .NET environment via IKVM, and there are several reasons you might wish to do this:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Where you need docx4j</span><span>’</span><span style="font-family: 'Calibri Light';">s capabilities, for example:</span></li><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">XHTML import</span><span style="font-family: 'Calibri Light';">/export/roundtrip</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">PDF export</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">OpenDoPE processing</span></li></ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">Capabilities provided by docx4j </span><span style="font-family: 'Calibri Light';">enterprise edition (as to which see above)</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Where you need to work in both Java and .NET, and want to use a single API in both environments</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">Where you need the source code (Microsoft doesn</span><span>’</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">t </span><span style="font-family: 'Calibri Light';">provide that)</span></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">You can use docx4j.NET and the OpenXML SDK together; see </span><a href="https://github.com/plutext/docx4j.NET/blob/master/docx4j.NET/src/samples/c%23/Docx4NET/InteropDocx.cs"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">InteropDocx</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">As on the Java platform, docx4j.NET comes in community and commercial editions.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">See </span><a href="https://www.nuget.org/packages/docx4j.NET/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://www.nuget.org/packages/docx4j.NET/</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591806" /><span style="font-family: 'Liberation Serif';">What Word documents does it support?</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Docx4j can read/write docx documents created by or for Word 2007</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> or later, </span><span class="" style="font-family: 'Calibri Light';">plus</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> earlier versions which have the compatibility pack installed. (Same goes for xlsx spreadsheets and pptx presentations).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">The relevant parts of docx4j are generated from the ECMA schemas</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">, with the addition of the key </span><span class="" style="font-family: 'Calibri Light';">Microsoft proprietary extensions.</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  For unsupported extensions, docx4j gracefully degrades to the specified 2007 substitutes.</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">It </span><span class="" style="font-family: 'Calibri Light';">is not really intended</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> read/write Word 2003 XML documents, although </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">package</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> org.docx4j.convert.in.word2003xml </span></span><span class="" style="font-family: 'Calibri Light';">is a proof of concept of importing such documents.</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">For more information, please see </span><a href="#_Ref280708892"><span class="DefaultParagraphFont " style="font-weight: bold;font-style: italic;;font-family: 'Calibri Light';">Specification versions</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> below.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591807" /><span style="font-family: 'Liberation Serif';">Handling legacy binary .doc files</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">An effective approach is to use LibreOffice or OpenOffice (via jodconverter) to convert the doc to docx, which docx4j can then process.  If you need to return a binary .doc, LibreOffice or </span><span class="" style="font-family: 'Calibri Light';">OpenOffice/jodconverter can convert the docx back to .doc.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">With 8.2.0, docx4j can also convert binary .doc or RTF to docx, using Microsoft Word courtesy of documents4j.   The sub-projects docx4j-documents4j-local and docx4j-documents4j-remote provide an interface to documents4j which is convenient for docx4j users.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591808" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Getting Help: the docx4j forum</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Free community support is available in the docx4j forum, at </span><a href="http://www.docx4java.org/forums/"><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri Light';">http://www.docx4java.org/forums/</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri Light';">and on Stack Overflow.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Before posting, please:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">check this document doesn</span><span>’</span><span style="font-family: 'Calibri Light';">t answer your question</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">try to help yourself: people are unlikely to help you if it looks like you are asking someone else to do lots of work you presumably are being paid to do!</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">ensure your post says which version of docx4j you are using, and contains your Java code (between [java] .. and .. [/java]) and XML (between [xml] .. and .. [/xml])</span><span style="font-family: 'Calibri Light';">, and if appropriate a docx/pptx/xlsx attachment</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">consider browsing relevant docx4j source code </span></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">This discussion is generally in English.  If you </span><span class="" style="font-family: 'Calibri Light';">would like</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> to moderate a forum in another language (for example, French, Chinese, Spanish</span><span class="" style="">…</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">), please let us know.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591809" /><span style="font-family: 'Liberation Serif';">A word about Jaxb</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">docx4j uses JAXB to marshall and unmarshall the XML parts in a docx/pptx/xlsx.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Docx4j supports each of the 3 JAXB implementations:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">the JAXB in Java 8 implementation; to use this, you need the </span><span style="font-family: 'Calibri Light';">docx4j-JAXB-Internal</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">jar. You can also use this with Java 9.  But not Java 11, since </span><span style="font-family: 'Calibri Light';">Java 11 does not ship JAXB anymore.</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><br /></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">the Sun/Oracle/"Reference" implementation</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">; to use this you need </span><span style="font-family: 'Calibri Light';">docx4j-JAXB-ReferenceImpl</span></li></ul>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="" style="font-family: 'Calibri Light';">You can also use the JAXB reference implementation (eg v2.2.4).  If you want to use that in preference to the version included in the JDK, do so using the endorsed directory mechanism.</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Moxy</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">.  To use this, you need </span><span style="font-family: 'Calibri Light';">docx4j-JAXB-MOXy</span><span style="font-family: 'Calibri Light';">.</span><br /></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">IBM's (in WebSphere).  </span><span style="font-family: 'Calibri Light';">By default, WebSphere uses com.ibm.xml.xlxp2.jaxb, which has the concept of fallback/ MarshallerProxy.  The actual implementation it uses is in com.ibm.jaxb.tools.jar.</span></li></ul>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591810" /><span style="font-family: 'Liberation Serif';">Using docx4j via Maven</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">docx4j is in Maven Central.  For Maven users, t</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">his makes it really easy to get going with docx4j.  </span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">To use docx4j 8.3.3</span><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">, add </span><span class="" style="font-family: 'Calibri Light';">one and only one of the following to your project:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;!-- use the JAXB shipped in Java 8 --&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;dependency&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">&lt;groupId&gt;org.docx4j&lt;/groupId&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">&lt;artifactId&gt;</span></span><span class="DefaultParagraphFont " style="font-weight: bold;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j-JAXB-</span><span class="DefaultParagraphFont " style="font-weight: bold;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Internal</span><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Hack Regular';">&lt;/artifactId&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">&lt;version&gt;8.</span></span><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Hack Regular';">3.3&lt;/version&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;/dependency&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">      </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;!-- use the JAXB Reference Implementation --&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;dependency&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">&lt;groupId&gt;org.docx4j&lt;/groupId&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">&lt;artifactId&gt;</span></span><span class="DefaultParagraphFont " style="font-weight: bold;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j-JAXB-</span><span class="DefaultParagraphFont " style="font-weight: bold;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">ReferenceImpl</span><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Hack Regular';">&lt;/artifactId&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">&lt;version&gt;8.</span></span><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Hack Regular';">3.3&lt;/version&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;/dependency&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">      </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;!-- use the MOXy JAXB implementation --&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;dependency&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">&lt;groupId&gt;org.docx4j&lt;/groupId&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">&lt;artifactId&gt;</span></span><span class="DefaultParagraphFont " style="font-weight: bold;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j-JAXB-</span><span class="DefaultParagraphFont " style="font-weight: bold;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">MOXy</span><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Hack Regular';">&lt;/artifactId&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">&lt;version&gt;8.</span></span><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Hack Regular';">3.3&lt;/version&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"><span class="DefaultParagraphFont " style="font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;/dependency&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">The blog entry </span><a href="http://www.docx4java.org/blog/2011/10/hello-maven-central/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">hello-maven-central</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /><span class="" style="font-family: 'Calibri Light';">s</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> [needs to be updated per above] s</span><span class="" style="font-family: 'Calibri Light';">hows you what to do, starting with a fresh OS (Win 7 is used, but these steps would work equally well on OSX or Linux).</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591811" /><span style="font-family: 'Liberation Serif';">Using docx4j binaries</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">If Maven is not for you, y</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">ou can download the latest version of docx4j from </span><a href="http://www.docx4java.org/docx4j/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">http://</span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">www.docx4java</span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">.org/docx4j/</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Supporting jars can be found in the .tar.gz or zip version, or in the relevant subdirectory.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">You'll need the jars from one and only one of these directorie</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">s: </span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">docx4j-JAXB-Internal, </span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">docx4j-JAXB-ReferenceImpl, </span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">docx4j-JAXB-MOXy</span></li></ul>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591812" /><span style="font-family: 'Liberation Serif';">docx4j dependencies</span></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc96591813" /><span style="font-family: 'Liberation Serif';">slf</span><span style="font-family: 'Liberation Serif';">4j</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">To do anything with docx4j, you need </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">slf4j</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> on your classpath.  As the slf4j website puts it:</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="DefaultParagraphFont " style="color: #777777;background-color: #FFFFFF;font-size: 10.0pt;"><span class="" style="font-family: 'Noto Sans Tai Tham Medium';">The Simple Logging Facade for Java (SLF4J) serves as a simple facade or abstraction for various logging frameworks (e.g. java.util.logging, logback, log4j) allowing the end user to plug in the desired logging framework at </span></span><span class="Emphasis DefaultParagraphFont " style="color: #777777;background-color: #FFFFFF;font-size: 10.0pt;;font-family: 'Noto Sans Tai Tham Medium';">deployment</span><span class="apple-converted-space DefaultParagraphFont " style="color: #777777;background-color: #FFFFFF;font-size: 10.0pt;;font-family: 'Noto Sans Tai Tham Medium';"> </span><span class="DefaultParagraphFont " style="color: #777777;background-color: #FFFFFF;font-size: 10.0pt;;font-family: 'Noto Sans Tai Tham Medium';">time.</span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Noto Sans Tai Tham Medium';">So you need the slf4j api jar on your classpath:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Noto Sans Tai Tham Medium';white-space:pre-wrap;">  </span><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">&lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">dependency</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">groupId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">org.slf4j</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">groupId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">artifactId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">slf4j-api</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">artifactId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">version</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">1.7.26</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">version</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">dependency</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Noto Sans Tai Tham Medium';">If you want to use logback, then include it:</span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;margin-top: 0in;margin-bottom: 0in;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.5pt;">   <span class="" style="font-family: 'Hack Regular';">&lt;dependency&gt;</span></span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;margin-top: 0in;margin-bottom: 0in;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.5pt;">   <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  &lt;groupId&gt;ch.qos.logback&lt;/groupId&gt;</span></span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;margin-top: 0in;margin-bottom: 0in;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.5pt;">   <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  &lt;artifactId&gt;logback-classic&lt;/artifactId&gt;</span></span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;margin-top: 0in;margin-bottom: 0in;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.5pt;">   <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  &lt;version&gt;1.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.5pt;;font-family: 'Hack Regular';">2.10&lt;/version&gt;</span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;margin-top: 0in;margin-bottom: 0in;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.5pt;">   <span class="" style="font-family: 'Hack Regular';">&lt;/dependency&gt;</span></span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Noto Sans Tai Tham Medium';">If you want to use log4j, then include it, and:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">dependency</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">groupId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">org.slf4j</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">groupId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">artifactId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">slf4j-log4j12-impl</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">artifactId</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">version</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">2.17.1</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">version</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">dependency</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">See for example </span><a href="https://github.com/plutext/docx4j/blob/master/docx4j-samples-docx4j/pom.xml#L67"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://github.com/plutext/docx4j/blob/master/docx4j-samples-docx4j/pom.xml#L67</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc96591814" /><span style="font-family: 'Liberation Serif';">other dependencies</span><span style="font-family: 'Liberation Serif';white-space:pre-wrap;"> </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Depending what you want to do, the other</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> dependencies will be required.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Best practice is to include all dependencies on your class path, and be done with it.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">In your development environment, you can do this using Maven, or by physically copying them all to your classpath.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">For your deployment environment, your build process ought to be set up to do this for you.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591815" /><span style="font-family: 'Liberation Serif';">Docx4j source code</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Docx4j</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> source is on GitHub at </span><a href="https://github.com/plutext/docx4j"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://github.com/plutext/docx4j</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> .  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">We accept pull requests; pull requests are presumed to be contributions under ASLv2 per our contributor agreement.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">See </span><a href="http://www.docx4java.org/blog/2012/05/docx4j-from-github-in-eclipse/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">docx4j-from-github-in-eclipse</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> for details.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Source code can also be downloaded from Maven Central (search for docx4j at search.maven.org).</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591816" /><span style="font-family: 'Liberation Serif';">Javadoc</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Javadoc can be downloaded from Maven Central (search for docx4j at search.maven.org), but you</span><span class="" style="">’</span><span class="" style="font-family: 'Calibri Light';">ll find the source code much more useful!  See above.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591817" /><span style="font-family: 'Liberation Serif';">Building docx4j from source</span><span style="font-family: 'Liberation Serif';white-space:pre-wrap;"> </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Get the source code from GitHub (see above), then</span><span class="" style="">…</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> (you probably want to skip down to the next page, to get it working in Eclipse).</span></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc96591818" /><span style="font-family: 'Liberation Serif';">Command line -via Maven</span></p>
  
  <p class="Command NormalWeb Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Hack Regular';">export MAVEN_OPTS=-Xmx512m</span><span class="DefaultParagraphFont " style="color: #000000;"><br /></span><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">mvn install </span></p>
  
  <p class="Heading2 Normal DocDefaults " style="page-break-after: avoid;"><a name="_Toc96591819" /><span style="font-family: 'Liberation Serif';">Eclipse</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">See </span><a href="http://www.docx4java.org/blog/2012/05/docx4j-from-github-in-eclipse/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">docx4j-from-github-in-eclipse</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /><span class="" style="font-family: 'Calibri Light';">.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Not working?</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Enable Maven (make sure you have Maven and its plugin installed - see Prerequisites above):</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">with Eclipse Indigo</span></li><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Right click on the project</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Click "Configure &gt; Convert to Maven Project"</span></li></ul></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">compiler version &amp; system library:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Right click on the project (or Alt-Enter)</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Choose "Java Compiler", then set JDK compliance to 1.</span><span style="font-family: 'Calibri Light';">8</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">Choose "Java Build Path", and check you are using 1.</span><span style="font-family: 'Calibri Light';">8</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">"JRE System Library". If not, remove, then click "Add Library"</span></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">The project should now be working in Eclipse without errors</span><span class="FootnoteReference DefaultParagraphFont " style="vertical-align: top; font-size: xx-small"><a name="fs2"><a href="#fn2">2</a></a></span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">. </span></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc96591820" /><span style="font-family: 'Liberation Serif';">Using a different IDE?</span></p>
  
  <p class="Normal DocDefaults "><span class="underline DefaultParagraphFont " style="font-family: 'Calibri Light';">Please post setup instructions in the forum, or as a wiki page on GitHub.  Thanks!</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591821" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Open an existing docx/pptx/xlsx document</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/openpackaging/packages/WordprocessingMLPackage.java"><span class="DefaultParagraphFont " style="font-family: 'Hack Regular';">org.docx4j.openpackaging.packages.</span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';">WordprocessingMLPackage</span></a><span style="font-family: 'Calibri Light';"> represents a docx document.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">To load a document</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> or </span><span class="" style="">“</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Flat OPC</span><span class="" style="">” </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">XML file</span><span class="" style="font-family: 'Calibri Light';">, all you have to do is:</span></p>
  
  <p class="Command NormalWeb Normal DocDefaults " style="position: relative; margin-left: 0in;">   <span style="font-family: 'Hack Regular';white-space:pre-wrap;">WordprocessingMLPackage wordMLPackage = </span><br />      <span style="font-family: 'Hack Regular';">WordprocessingMLPackage.load(new java.io.File(inputfilepath));</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">You can use the façade:</span></p>
  
  <p class="Command NormalWeb Normal DocDefaults " style="position: relative; margin-left: 0in;">   <span style="font-family: 'Hack Regular';white-space:pre-wrap;">WordprocessingMLPackage wordMLPackage = </span><br />      <span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';">Docx4J</span><span style="font-family: 'Hack Regular';">.load(new java.io.File(inputfilepath));</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">which does the same thing under the covers.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">There are similar signatures to load from an input stream.  </span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">You can then get the main document part (word/document.xml):</span></p>
  
  <p class="Command NormalWeb Normal DocDefaults "><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/openpackaging/parts/WordprocessingML/MainDocumentPart.java"><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">MainDocumentPart</span></a><span style="font-family: 'Hack Regular';"> documentPart = wordMLPackage.getMainDocumentPart();</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">After that, you can manipulate its contents. </span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">A similar approach works for pptx files:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">PresentationMLPackage presentationMLPackage = </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">(PresentationMLPackage)OpcPackage.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 8.0pt;;font-family: 'Hack Regular';">load</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">(</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">new</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> java.io.File(inputfilepath));</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">And similarly for xlsx files.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591822" /><span style="font-family: 'Liberation Serif';">OpenXML</span><span style="font-family: 'Liberation Serif';white-space:pre-wrap;"> </span><span style="font-family: 'Liberation Serif';white-space:pre-wrap;">concepts</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">To do anything much beyond this, you need to have an understanding of basic WordML concepts</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> (or PresentationML or SpreadsheetML)</span><span class="" style="font-family: 'Calibri Light';">.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">According to the Microsoft Open Packaging spec, each docx document is made up of a number of </span><span class="" style="">“</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Part</span><span class="" style="">” </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">files, zipped up.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">An easy way to get an understanding of this is to unzip a docx/pptx/xlsx using your favourite zip utility.  Even easier is to visit </span><a href="http://webapp.docx4java.org"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">http://webapp.docx4java.org</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  and explore your file using </span><span class="" style="">“</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">PartsList</span><span class="" style="">”</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">.  You can also generate code that way.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">A Part is usually XML, but might not be (an image part, for example, isn't).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">The parts form a tree. If a part has child parts, it must have a relationships part which identifies these.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">The part which contains the main text of the document is the Main Document Part.  Each Part has a name.  The name of the Main Document Part is usually "/word/document.xml".</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">If the document has a header, then the main document part woud have a header child part, and this would be described in the main document part's relationships (part).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Similarly for any images.  To see the structure of any given document, </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">upload it to the PartsList webapp</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">, or run the "Parts List" sample (see </span><span class="" style="font-family: 'Calibri Light';">further below).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">An introduction to WordML is beyond the scope of this document.  You can find a very readable introduction in 1</span><span class="DefaultParagraphFont " style="vertical-align: super;font-size: smaller;;font-family: 'Calibri Light';">st</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> edition Part 3 (Primer) at </span><a href="http://www.ecma-international.org/publications/standards/Ecma-376.htm"><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri Light';">http://www.ecma-international.org/publications/standards/Ecma-376.htm</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> or </span><a href="http://www.ecma-international.org/news/TC45_current_work/TC45_available_docs.htm"><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri Light';">http://www.ecma-</span><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri Light';">international.org/news/TC45_current_work/TC45_available_docs.htm</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> (a better link for the 1st edition (Dec 2006), since its not zipped up). </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">See also the free </span><a href="http://openxmldeveloper.org/cfs-file.ashx/__key/communityserver-components-postattachments/00-00-00-19-70/Open-XML-Explained.pdf"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">"Open XML Explained" ebook</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri Light';">by Wouter Van Vugt</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">.  </span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Ref280708892" /><a name="_Toc96591823" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Specification versions</span><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';white-space:pre-wrap;"> </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">From Wikipedia:</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">The</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';"> </span><a alt="Office Open XML" href="http://en.wikipedia.org/wiki/Office_Open_XML"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;;font-family: 'Calibri Light';">Office Open XML</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';white-space:pre-wrap;">file formats were standardised between December 2006 and November 2008, </span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">first by the</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';"> </span><a alt="Ecma International" href="http://en.wikipedia.org/wiki/Ecma_International"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;;font-family: 'Calibri Light';">Ecma International</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">consortium (where they became</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';"> </span><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;;font-family: 'Calibri Light';">ECMA-376</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';white-space:pre-wrap;">), </span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">and subsequently .. by the</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';"> </span><a alt="International Organization for Standardization" href="http://en.wikipedia.org/wiki/International_Organization_for_Standardization"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;;font-family: 'Calibri Light';">ISO</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';" /><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">/</span><a alt="International Electrotechnical Commission" href="http://en.wikipedia.org/wiki/International_Electrotechnical_Commission"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;;font-family: 'Calibri Light';">IEC</span></a><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">'s</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';"> </span><a alt="International Organization for Standardization" href="http://en.wikipedia.org/wiki/International_Organization_for_Standardization#ISO.2FIEC_Joint_Technical_Committee_1"><span class="Hyperlink DefaultParagraphFont " style="color: #0645AD;;font-family: 'Calibri Light';">Joint Technical Committee 1</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">(where they became</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';"> </span><span class="apple-style-span DefaultParagraphFont " style="font-weight: bold;color: #000000;;font-family: 'Calibri Light';">ISO/IEC 29500:2008</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">The Ecma-376.htm link also contains the 2nd edition documents (of Dec 2008), which are </span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri Light';">"</span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri Light';">technically aligned with ISO/IEC 29500".</span></p>
  
  <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri Light';">Office 2007 SP2 implements ECMA-376 1st Edition</span><span class="FootnoteReference DefaultParagraphFont " style="color: #333333;;vertical-align: top; font-size: xx-small"><a name="fs3"><a href="#fn3">3</a></a></span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri Light';white-space:pre-wrap;">; this is what docx4j </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri Light';">started with</span></p>
  
  <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri Light';">ISO/IEC 29500 (ECMA-376 2nd Edition) has</span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri Light';"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-style: italic;;font-family: 'Calibri Light';">Strict</span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri Light';"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri Light';">and</span><span class="apple-converted-space DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri Light';"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;font-style: italic;;font-family: 'Calibri Light';white-space:pre-wrap;">Transitional </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri Light';">conformance classes.  Office 2010 supports</span><span class="FootnoteReference DefaultParagraphFont " style="color: #333333;;vertical-align: top; font-size: xx-small"><a name="fs4"><a href="#fn4">4</a></a></span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> transitional, and also has read only support for strict.</span></span></p>
  
  <p class="Normal DocDefaults "><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri Light';">docx4j started with</span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;;font-family: 'Calibri Light';">ECMA-376 1st Edition.</span><span class="apple-style-span DefaultParagraphFont " style="color: #333333;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  Where appropriate later versions of the schemas are used.  docx4j 3.0 uses MathML 2ed, PresentationML 2ed, and SpreadsheemML 4ed transitional.</span></span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Docx4j can open documents which contain Word 2010, 2013</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> specific </span><span class="" style="font-family: 'Calibri Light';">content.</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  The key extensions are supported.  For other stuff</span><span class="" style="font-family: 'Calibri Light';">, for example,  &lt;w14:glow w14:rad="101600"&gt;  it will look for and try to use mc:AlternateContent contained in the document.</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  If you use docx4j to save the document, the w14:glow won</span><span class="" style="">’</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">t be there any more (ie the docx will effectively be a Word 2007 docx).</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591824" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Architecture</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Docx4j has 3 layers:</span></p><ol>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';">org.docx4j.openpackaging</span><br /><br /><span style="font-family: 'Calibri Light';">OpenPackaging handles things at the O</span><span style="font-family: 'Calibri Light';">pen Packaging Conventions level.</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><br /><br /><span style="font-family: 'Calibri Light';">It includes objects corresponding to each Office file type</span><span style="font-family: 'Calibri Light';">:</span></li></ol>
  
  <p class="ListParagraph Normal DocDefaults "> </p>
  
  <table class="TableGrid TableNormal " id="docx4j_tbl_0" style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 19mm;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 5.89in;"><colgroup><col style="width: 21.73%;" /><col style="width: 78.27%;" /></colgroup><tbody><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="ListParagraph-TableGrid-BR DocDefaults " style="position: relative; margin-left: 0in;"><span class="" style="font-family: 'Calibri Light';">docx</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="ListParagraph-TableGrid-BR DocDefaults " style="position: relative; margin-left: 0in;"><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">org.docx4j.openpackaging.packages.</span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">WordprocessingMLPackage</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="ListParagraph-TableGrid-BR DocDefaults " style="position: relative; margin-left: 0in;"><span class="" style="font-family: 'Calibri Light';">pptx</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="ListParagraph-TableGrid-BR DocDefaults " style="position: relative; margin-left: 0in;"><span class="" style="font-family: 'Calibri Light';">org.docx4j.openpackaging.packages.</span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">PresentationMLPackage</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="ListParagraph-TableGrid-BR DocDefaults " style="position: relative; margin-left: 0in;"><span class="" style="font-family: 'Calibri Light';">xlsx</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="ListParagraph-TableGrid-BR DocDefaults " style="position: relative; margin-left: 0in;"><span class="" style="font-family: 'Calibri Light';">org.docx4j.openpackaging.packages.</span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">SpreadsheetMLPackage</span></p></td></tr></tbody></table>
  
  <p class="ListParagraph Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">and is responsible for unzipping the file into a set of objects inheriting from Part;  </span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';">openpackaging</span><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">also includes functionalitiy </span><span class="" style="font-family: 'Calibri Light';">allowing parts to be added/deleted; saving the docx/pptx/xlsx etc</span><br /><span class="" style="font-family: 'Calibri Light';" /><br /><span class="" style="font-family: 'Calibri Light';" /><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">This layer is based originally on OpenXML4J (which is also used by Apache POI). </span><br /><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p><ol>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">Parts are generally subclasses of </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;;font-family: 'Hack Regular';">org</span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';">.docx4j.</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;;font-family: 'Hack Regular';">openpackaging</span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';">.parts.JaxbXmlPart</span><br /><br /><span style="font-family: 'Calibri Light';white-space:pre-wrap;">This (the </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;;font-family: 'Calibri Light';">jaxb</span><span class="DefaultParagraphFont " style="font-weight: bold;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> content tree</span></span><span style="font-family: 'Calibri Light';">) is the second level of the three layered model.</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">   </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">To explore these first two layers for a given document, </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">upload it to the PartsList webapp</span></a><span style="font-family: 'Calibri Light';">.</span><br /><br /><span style="font-family: 'Calibri Light';white-space:pre-wrap;">Parts are arranged in a tree.  If a part has descendants, it will have a </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';">org.docx4j.openpackaging.parts.relationships.RelationshipsPart</span><span style="font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">which identifies those descendant parts.  </span><br /><br /><span style="font-family: 'Calibri Light';">A JaxbXmlPart has a content tree:</span><br /><br /><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   <span class="" style="font-family: 'Hack Regular';">public Object getJaxbElement() {</span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   <span class="" style="font-family: 'Hack Regular';">return jaxbElement;</span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   <span class="" style="font-family: 'Hack Regular';">}</span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   <span class="" style="font-family: 'Hack Regular';">public void setJaxbElement(Object jaxbElement) {</span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   <span class="" style="font-family: 'Hack Regular';">this.jaxbElement = jaxbElement;</span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   <span class="" style="font-family: 'Hack Regular';">}</span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span></li></ol>
  
  <p class="ListParagraph Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Most parts (including MainDocumentPart, styles, headers/footers, comments, </span><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">endnotes</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">/footnotes) use </span><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/wml"><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';">org.docx4j.wml</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">(WordprocessingML); </span><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">wml</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> references </span><a href="http://dev.plutext.org/trac/docx4j/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/wml"><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';">org.docx4j.dml</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri Light';">(DrawingML) as necessary.</span><br /><span class="" style="font-family: 'Calibri Light';" /><br /><span class="" style="font-family: 'Calibri Light';">These classes were generated from the Open XML schemas</span><br /><span class="" style="font-family: 'Calibri Light';" /></p><ol>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';">org.docx4j.model</span><span class="DefaultParagraphFont " style="font-weight: bold;"><br /></span><span class="DefaultParagraphFont " style="font-weight: bold;"><br /></span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">This package builds on the lower two layers to provide extra functionality, and is being progressively further developed.    </span></li></ol>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591825" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Jaxb: marshalling and unmarshalling</span><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';white-space:pre-wrap;"> </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Docx4j contains a class representing each part.  For example, there is a </span><span class="DefaultParagraphFont " style="font-family: 'Hack Regular';">MainDocumentPart</span><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">class.  XML parts inherit from </span><span class="DefaultParagraphFont " style="font-family: 'Hack Regular';">JaxbXmlPart</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">, which contains a member called </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';">jaxbElement</span><span class="" style="font-family: 'Calibri Light';">.  When you want to work with the contents of a part, you work with its jaxbElement</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> by using the </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';">get|setContents</span><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">method</span><span class="" style="font-family: 'Calibri Light';">.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">When you open a docx document using docx4j, docx4j automatically </span><span class="DefaultParagraphFont " style="font-weight: bold;font-style: italic;;font-family: 'Calibri Light';">unmarshals</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> the contents of each XML part to a strongly-type Java object tree (the jaxbElement).  Actually, docx4j 3.0 is lazy;  it only does this when first needed.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Similarly, if/when you tell docx4j to save these Java objects as a docx, docx4j automatically </span><span class="DefaultParagraphFont " style="font-weight: bold;font-style: italic;;font-family: 'Calibri Light';">marshals</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> the jaxbElement in each Part.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Sometimes you will want to marshal or unmarshal things yourself.  The class </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.jaxb.Context</span><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">defines all t</span><span class="" style="font-family: 'Calibri Light';">he JAXBContexts used in docx4j.  Here is representative (non-exhaustive) content:</span></p>
  
  <table class="TableGrid TableNormal " id="docx4j_tbl_1" style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 0.76in;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 4.94in;"><colgroup><col style="width: 40.51%;" /><col style="width: 59.49%;" /></colgroup><tbody><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Hack Regular';">Jc</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.wml</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;"><br /><span class="" style="font-family: 'Hack Regular';">org.docx4j.dml</span><br /><span class="" style="font-family: 'Hack Regular';">org.docx4j.dml.picture</span><br /><span class="" style="font-family: 'Hack Regular';">org.docx4j.dml.wordprocessingDrawing</span><br /><span class="" style="font-family: 'Hack Regular';">org.docx4j.vml</span><br /><span class="" style="font-family: 'Hack Regular';">org.docx4j.vml.officedrawing</span><br /><span class="" style="font-family: 'Hack Regular';">org.docx4j.math</span></span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">jcThemePart</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.dml</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">jcDocPropsCore</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.docProps.core</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.docProps.core.dc.elements</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.docProps.core.dc.terms</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">jcDocPropsCustom</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.docProps.custom</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">jcDocPropsExtended</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.docProps.extended</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">jcXmlPackage</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.xmlPackage</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">jcRelationships</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.relationships</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">jcCustomXmlProperties</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.customXmlProperties</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">jcContentTypes</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.openpackaging.contenttype</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;vertical-align: middle;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">jcPML</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.pml</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;"><br /><span class="" style="font-family: 'Hack Regular';">org.docx4j.dml</span><br /><span class="" style="font-family: 'Hack Regular';">org.docx4j.dml.picture</span></span></p></td></tr></tbody></table>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #FFFF00; border-style:solid; border-width:1px;background-color: #FFFF00;"><span class="DefaultParagraphFont " style=""><span class="" style="font-family: 'Calibri Light';">You</span><span class="" style="">’</span><span class="" style="font-family: 'Calibri Light';">ll find XmlUtils.marshalToString very useful as you put your code together.  With this, you can easily output the content of a JAXB object, to see what XML it represents.</span></span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591826" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Parts List</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">To get a better understanding of how docx4j works </span><span class="" style="">– </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">and the structure of a docx document </span><span class="" style="">– </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">you can run the PartsList sample on a docx (or a pptx or xlsx).  If you do, it will list the hierarchy of parts used in that package.  It will tell you which class is used to represent each part, and where that part is a JaxbXmlPart, it will also tell you what class the </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">jaxbElement </span><span class="" style="font-family: 'Calibri Light';">is.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">So it</span><span class="" style="">’</span><span class="" style="font-family: 'Calibri Light';">s a bit like unzipping the docx/pptx/xlsx file, but it tells you what Java objects are being used for each part.</span></p>
  
  <table class="TableGrid TableNormal " id="docx4j_tbl_2" style="background-color: #FFFF00;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 0in;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 6.65in;"><colgroup><col style="width: 100%;" /></colgroup><tbody><tr><td style="background-color: #FFFF00;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">A more fully featured tool is </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">the PartsList online webapp</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /><span class="" style="font-family: 'Calibri Light';">.  With this, you can:</span></p><ul>
  
  <li class="ListParagraph-TableGrid-BR DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">browse through the package, </span></li>
  
  <li class="ListParagraph-TableGrid-BR DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">look up what elements mean in the spec, and </span></li>
  
  <li class="ListParagraph-TableGrid-BR DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">generate code.</span></li></ul>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">Alternatively, you can install the </span><a href="http://www.plutext.com/dn/downloads/1441189231363/Docx4jHelper-1_0.exe"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Docx4j Helper Word AddIn</span></a><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">, to generate code from within Word.  See also forum </span><a href="http://www.docx4java.org/forums/docx4jhelper-addin-f30/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">http://www.docx4java.org/forums/docx4jhelper-addin-f30/</span></a><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p></td></tr></tbody></table>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">You can run PartsList locally</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> from a command line:</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.5in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Liberation Mono';">java -cp docx4j-3.0.1.jar:log4j-1.2.17.jar;</span><span class="DefaultParagraphFont " style="color: #222222;background-color: #FFFFFF;font-size: 6.5pt;;font-family: 'Liberation Mono';">slf4j-api-1.7.5.jar;slf4j-log4j12-1.7.5.jar</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Liberation Mono';white-space:pre-wrap;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;"><br /><span class="" style="font-family: 'Liberation Mono';">org.docx4j.samples.</span></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Liberation Mono';white-space:pre-wrap;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Liberation Mono';">PartsList [input.docx]</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">though I always find it easier to run it from my IDE.   Example</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> output: </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">Part /_rels/.rels [org.docx4j.openpackaging.parts.relationships.RelationshipsPart]</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><br /><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  containing JaxbElement:org.docx4j.relationships.Relationships</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">Part /docProps/app.xml [org.docx4j.openpackaging.parts.DocPropsExtendedPart]  </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><br /><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  containing JaxbElement:org.docx4j.docProps.extended.Properties</span></span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">Part /docProps/core.xml [org.docx4j.openpackaging.parts.DocPropsCorePart]  </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><br /><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  containing JaxbElement:org.docx4j.docProps.core.CoreProperties</span></span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">Part </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">/word/document.xml</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> [org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart]  </span><br /><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  containing JaxbElement:org.docx4j.wml.Document</span></span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">Part /word/settings.xml [</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 7.0pt;;font-family: 'Hack Regular';">org.docx4j.openpackaging.parts.WordprocessingML</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">.DocumentSettingsPart]  </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><br /><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  containing JaxbElement:org.docx4j.wml.CTSettings</span></span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">Part /word/styles.xml [</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 7.0pt;;font-family: 'Hack Regular';">org.docx4j.openpackaging.parts.WordprocessingML</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">.StyleDefinitionsPart]  </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><br /><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  containing JaxbElement:org.docx4j.wml.Styles</span></span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">Part /word/media/image1.jpeg [</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 7.0pt;;font-family: 'Hack Regular';">org.docx4j.openpackaging.parts.WordprocessingML</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">.ImageJpegPart] </span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">docx4j includes convenience methods to make it easy to access commonly used parts. These include,</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">on the package:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> MainDocumentPart getMainDocumentPart() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> DocPropsCorePart getDocPropsCorePart() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> DocPropsExtendedPart getDocPropsExtendedPart() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> DocPropsCustomPart getDocPropsCustomPart() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">on the document part:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> StyleDefinitionsPart getStyleDefinitionsPart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> NumberingDefinitionsPart getNumberingDefinitionsPart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> ThemePart getThemePart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> FontTablePart getFontTablePart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> CommentsPart getCommentsPart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> EndnotesPart getEndNotesPart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> FootnotesPart getFootnotesPart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> DocumentSettingsPart getDocumentSettingsPart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> WebSettingsPart getWebSettingsPart()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">If a part points to any other parts, it will have a relationships part listing these other parts. </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Liberation Mono';">RelationshipsPart rp = part.getRelationshipsPart();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">You can access those, and from there, get the part you want:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">for</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> ( Relationship r : rp.getRelationships().getRelationship() ) {</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="color: #0000C0;font-style: italic;font-size: 8.0pt;;font-family: 'Liberation Mono';">log</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Liberation Mono';">.info(</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Liberation Mono';">"\nFor Relationship Id="</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> + r.getId() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">            <span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;">+ </span></span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Liberation Mono';">" Source is "</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> + rp.getSourceP().getPartName() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">            <span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;">+ </span></span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Liberation Mono';">", Target is "</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> + r.getTarget() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">            <span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;">+ </span></span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Liberation Mono';">" type "</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> + r.getType() + </span></span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Liberation Mono';">"\n"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Liberation Mono';">);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Liberation Mono';">Part part = rp.getPart(r);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Liberation Mono';">}</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         </span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">That gives access to just the parts this part points to.</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;">RelationshipsPart </span><span class="" style="font-family: 'Calibri Light';">contains</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> various useful utility methods, for example</span><span class="" style="font-family: 'Calibri Light';">:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;;font-family: 'Hack Regular';">/** Gets a loaded Part by its id */</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Hack Regular';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> Part </span></span><span class="DefaultParagraphFont " style="color: #000000;background-color: #D3D3D3;font-size: 10.0pt;;font-family: 'Hack Regular';">getPart</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">(String id) </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Hack Regular';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> Part getPart(Relationship r ) {</span></span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">The  </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;">RelationshipsPart </span><span class="" style="font-family: 'Calibri Light';">is the key player when it comes to adding/removing images and other parts from your document.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">There is also a list of </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">all</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> parts, in the package object:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Liberation Mono';">Parts parts = wordMLPackage.getParts();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">The Parts object encapsulates a map of parts, keyed by PartName, but you generally shouldn</span><span class="" style="">’</span><span class="" style="font-family: 'Calibri Light';">t add/remove things here directly!</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">To add a part, see the section </span><a href="#_Ref275255216"><span style="font-family: 'Calibri Light';">Adding a Part</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> below.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591827" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">MainDocumentPart</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">The text of the document is to be found in the main document part.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Its XML will look something like:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&lt;</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:document</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Hack Regular';">xmlns:w</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">http://schemas.openxmlformats.org/wordprocessingml/2006/main</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> &gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:body</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:p</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> &gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">      &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:pPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">        &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:pStyle</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Hack Regular';">w:val</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">Heading1</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">/&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">      &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:pPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">      &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:r</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">        &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:t</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">Hello World</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:t</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">      &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:r</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">    &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:p</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">    :</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">    &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:sectPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> &gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">      &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:pgSz</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Hack Regular';">w:w</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">12240</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Hack Regular';">w:h</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">15840</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">/&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">      &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:pgMar</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Hack Regular';">w:top</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">1440</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Hack Regular';">w:right</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">1440</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Hack Regular';">w:bottom</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">1440</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Hack Regular';">w:left</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">1440</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Hack Regular';">w:header</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">708</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Hack Regular';">w:footer</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">708</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.5pt;;font-family: 'Hack Regular';">w:gutter</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">=</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">0</span><span class="DefaultParagraphFont " style="font-size: 9.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">/&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">    &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:sectPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:body</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 9.5pt;;font-family: 'Hack Regular';">w:document</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">Given:</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">WordprocessingMLPackage wordMLPackage</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">you can access:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   <span class="" style="font-family: 'Liberation Mono';">MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">Classically, you'd then do:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   <span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;">org.docx4j.wml.Document wmlDocumentEl </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      <span class="" style="font-family: 'Liberation Mono';">= (org.docx4j.wml.Document) documentPart.getJaxbElement();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   <span class="" style="font-family: 'Liberation Mono';">Body body = wmlDocumentEl.getBody();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">But </span><span class="" style="font-family: 'Calibri Light';">you can skip some of that with:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;;font-family: 'Liberation Mono';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;">     * Convenience method to getJaxbElement().getBody().getContent()</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;">     */</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> List&lt;Object&gt; getContent() </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">A paragraph is org.docx4j.wml.P; a paragraph is basically made up of runs of text.</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #646464;font-size: 10.0pt;;font-family: 'Liberation Mono';">@</span><span class="DefaultParagraphFont " style="color: #646464;font-size: 10.0pt;text-decoration: underline;;font-family: 'Liberation Mono';">XmlRootElement</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;">(name = </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 10.0pt;;font-family: 'Liberation Mono';">"p"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Liberation Mono';">)</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Liberation Mono';">class</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> P </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Liberation Mono';">implements</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> Child, ContentAccessor</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">The </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Liberation Mono';">ContentAccessor</span><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">interface is simply:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;;font-family: 'Liberation Mono';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> * </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F9FBF;font-size: 10.0pt;;font-family: 'Liberation Mono';">@since</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> 2.7</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> */</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Liberation Mono';">interface</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #000000;background-color: #D3D3D3;font-size: 10.0pt;;font-family: 'Liberation Mono';">ContentAccessor</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> {</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> List&lt;Object&gt; getContent();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Liberation Mono';">}</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">it is implemented by a number of objects, including:</span></p>
  
  <table class="TableGrid TableNormal " id="docx4j_tbl_3" style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 0.86in;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 132mm;"><colgroup><col style="width: 33.97%;" /><col style="width: 24.53%;" /><col style="width: 41.5%;" /></colgroup><tbody><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">Body</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">w:body</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">document body</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">P</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">w:p</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">paragraph</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">R</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">w:r</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">run</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">Tbl</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">Tr</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">Tc</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">w:tbl</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">w:tr</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">w:tc</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">table</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">table row</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">table cell</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">SdtBlock</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">SdtRun</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">CTSdtRow</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">CTSdtCell</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">w:sdt</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">w:sdt</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">w:sdt</span></p>
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">w:sdt</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">content controls; see the method</span><span class="DefaultParagraphFont " style="color: #000000;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;">getSdtContent()</span></span></p></td></tr></tbody></table>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">As well as </span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-bottom: 0.07in;line-height: 100%;"><span style="font-family: 'Calibri Light';">Hdr, Ftr</span></li></ul>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #FFFF00; border-style:solid; border-width:1px;background-color: #FFFF00;"><span class="" style="font-family: 'Calibri Light';">Content is generally stored in a plain old Java List.  So there are familiar methods for inserting content at the end of the list, or other location in it.</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">Read on for how to add text etc.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591828" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Samples</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">The </span><span class="" style="font-family: 'Calibri Light';">modules:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span style="font-family: 'Calibri Light';">docx4j-samples-docx4j</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span style="font-family: 'Calibri Light';">docx4j-samples-docx-diffx</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span style="font-family: 'Calibri Light';">docx4j-samples-docx-export-fo</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span style="font-family: 'Calibri Light';">docx4j-samples-pptx4j</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span style="font-family: 'Calibri Light';">docx4j-samples-xlsx4j</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span style="font-family: 'Calibri Light';">docx4j-samples-glox4</span></li></ul>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">contains examples of how to do things with docx4j. </span><span class="" style="font-family: 'Calibri Light';">You can find them in the GitHub repo.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">The docx4j samples include:</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">Basics</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">CreateWordprocessingMLDocument</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">DisplayMainDocumentPartXml</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">OpenAndSaveRoundTripTest</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">PartsList</span></li></ul>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">Navigating the document body</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">OpenMainDocumentAndTraverse</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">XPathQuery</span></li></ul>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">Output/Transformation</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">ConvertOutHtml</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">ConvertOutPDF</span></li></ul>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">Import (X)HTML</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">AltChunkXHTMLRoundTrip</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">AltChunkAddOfTypeHtml</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">ConvertIn</span><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">XHTMLDocument</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">ConvertInXHTML</span><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">Fragment</span></li></ul>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">Image handling </span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">Image</span><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">Add</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">Image</span><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">ConvertEmbedded</span><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">ToLinked</span></li></ul>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">Part Handling</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">PartCopy</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">PartLoadFromFileSystem</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">PartsList</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">PartsStrip</span></li></ul>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">Document generation/document assembly using content controls</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">ContentControlsAddCustomXmlDataStoragePart</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">ContentControlsXmlEdit</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">ContentControlsApplyBinding</span><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">s</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">ContentControlBindingExtensions</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">ContentControlsPartsInfo</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">AltChunkAddOfTypeDocx</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">VariableReplace (not recommended)</span></li></ul>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">Specific docx features</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">BookmarkAdd</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">CommentsSample</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">HeaderFooterCreate</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">HeaderFooterList</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">HyperlinkTest</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">NumberingRestart</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">SubDocument</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">TableOfContentsAdd</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">TemplateAttach (attach your.dotx)</span></li></ul>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">Miscellaneous</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">CompareDocuments</span><span class="DefaultParagraphFont " style="font-size: 10.0pt;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> (in </span></span><span style="font-family: 'Calibri Light';">docx4j-samples-docx-diffx)</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">DocProps</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">Filter</span><span class="DefaultParagraphFont " style="font-size: 10.0pt;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> (remove proof errors, w:rsid)</span></span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">MergeDocx</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">UnmarshallFromTemplate</span></li></ul>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.25in;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">Flat OPC XML </span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">ConvertOutFlatOpenPackage</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Calibri Light';">ConvertInFlatOpenPackage</span></li></ul>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591829" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Creating a new docx</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">To create a new docx:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Hack Regular';">// Create the package</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Hack Regular';">// Save it</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Hack Regular';">wordMLPackage.save(new java.io.File("helloworld.docx") );</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">That's it.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">There</span><span class="" style="">’</span><span class="" style="font-family: 'Calibri Light';">s a sample you can try locally from a command line:</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 1in;text-indent: -0.5in;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Liberation Mono';">java -cp docx4j-3.0.1.jar:log4j-1.2.17.jar;</span><span class="DefaultParagraphFont " style="color: #222222;background-color: #FFFFFF;font-size: 6.5pt;;font-family: 'Liberation Mono';">slf4j-api-1.7.5.jar;slf4j-log4j12-1.7.5.jar</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Liberation Mono';white-space:pre-wrap;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;"><br /><span class="" style="font-family: 'Liberation Mono';">org.docx4j.samples.</span></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Liberation Mono';white-space:pre-wrap;"> </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 6.5pt;;font-family: 'Liberation Mono';">CreateDocx [input.docx]</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">createPackage() </span><span class="" style="font-family: 'Calibri Light';">is a convenience method, which does:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Hack Regular';">// Create the package</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">WordprocessingMLPackage wordMLPackage = new WordprocessingMLPackage();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Hack Regular';">// Create the main document part (word/document.xml)</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Hack Regular';">MainDocumentPart wordDocumentPart = new MainDocumentPart();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Hack Regular';">// Create main document part content</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">ObjectFactory factory = Context.getWmlObjectFactory();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.wml.Body body = factory .createBody();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.wml.Document wmlDocumentEl = factory .createDocument();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">wmlDocumentEl.setBody(body);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Hack Regular';">// Put the content in the part</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">wordDocumentPart.setJaxbElement(wmlDocumentEl);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">            </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Hack Regular';">// Add the main document part to the package relationships</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Hack Regular';">// (creating it if necessary)</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">wmlPack.addTargetPart(wordDocumentPart);</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Ref273525601" /><a name="_Toc96591830" /><span style="font-family: 'Liberation Serif';">docx4j.properties</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Here is a sample short </span><span class="" style="font-family: 'Calibri Light';">docx4j.properties file</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> (a complete one may be copied from </span><a href="https://github.com/plutext/docx4j/blob/master/docx4j-samples-resources/src/main/resources/docx4j.properties"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://github.com/plutext/docx4j/blob/master/docx4j-samples-resources/src/main/resources/docx4j.properties</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span class="" style="font-family: 'Calibri Light';">):</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';"># Page size: use a value from org.docx4j.model.structure.PageSizePaper enum</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';"># eg A4, LETTER</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j.PageSize=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">LETTER</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';"># Page size: use a value from org.docx4j.model.structure.MarginsWellKnown enum</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j.PageMargins=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">NORMAL</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j.PageOrientationLandscape=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">false</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';"># Page size: use a value from org.pptx4j.model.SlideSizesWellKnown enum</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';"># eg A4, LETTER</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">pptx4j.PageSize=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">LETTER</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">pptx4j.PageOrientationLandscape=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">false</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';"># These will be injected into docProps/app.xml</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';"># if App.Write=true</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j.App.write=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">true</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j.Application=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j.AppVersion=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">2.7</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';"># of the form XX.YYYY where X and Y represent numerical values</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';"># These will be injected into docProps/core.xml</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j.dc.write=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">true</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j.dc.creator.value=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j.dc.lastModifiedBy.value=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">#</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">#docx4j.McPreprocessor=true</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';"># If you haven't configured log4j yourself</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';"># docx4j will autoconfigure it.  Set this to true to disable that</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">docx4j.Log4j.Configurator.disabled=</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">false</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">The page size, margin &amp; orientation values are used when new documents are created; naturally they don't affect an existing document you open with docx4j.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">If no docx4j.properties file is found on your class path, docx4j has hard coded defaults.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591831" /><span style="font-family: 'Liberation Serif';">Adding a paragraph of text</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">MainDocumentPart </span><span class="" style="font-family: 'Calibri Light';">contains a method:</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">public </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.wml.P addStyledParagraphOfText(String styleId, String text)</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">You can use that method to add a paragraph using the specified style.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">The XML we are looking to create will be something like:</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&lt;</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;">w:p </span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;;font-family: 'Hack Regular';"> </span><span class="xmlmarkupattributename DefaultParagraphFont " style="color: #FF0000;font-size: 8.5pt;;font-family: 'Hack Regular';">xmlns:w</span><span class="xmlmarkupattributevalue DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">="http://schemas.openxmlformats.org/wordprocessingml/2006/main"</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><span class="" style="font-family: 'Hack Regular';">    </span></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&lt;</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Hack Regular';">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><span class="" style="font-family: 'Hack Regular';">        </span></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&lt;</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Hack Regular';">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;;font-family: 'Hack Regular';">Hello world</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&lt;/</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Hack Regular';">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><span class="" style="font-family: 'Hack Regular';">    </span></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&lt;/</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Hack Regular';">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&lt;/</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Hack Regular';">w:p</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">addStyledParagraphOfText </span><span class="" style="font-family: 'Calibri Light';">builds the object structure </span><span class="" style="">“</span><span class="" style="font-family: 'Calibri Light';">the JAXB way</span><span class="" style="">”</span><span class="" style="font-family: 'Calibri Light';">, and adds it to the document.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">It is based on:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Hack Regular';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> org.docx4j.wml.P createParagraphOfText(String simpleText) {</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      <span class="" style="font-family: 'Hack Regular';">org.docx4j.wml.ObjectFactory factory = Context.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 10.0pt;;font-family: 'Hack Regular';">getWmlObjectFactory</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';">();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      <span class="" style="font-family: 'Hack Regular';">org.docx4j.wml.P  para = factory.createP();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Hack Regular';">if</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> (simpleText!=</span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Hack Regular';">null</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';">) {</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">         <span class="" style="font-family: 'Hack Regular';">org.docx4j.wml.Text  t = factory.createText();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">         <span class="" style="font-family: 'Hack Regular';">t.setValue(simpleText);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">         <span class="" style="font-family: 'Hack Regular';">org.docx4j.wml.R  run = factory.createR();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">         <span class="" style="font-family: 'Hack Regular';">run.</span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';">getContent</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">().add(t); </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 10.0pt;;font-family: 'Hack Regular';">// ContentAccessor</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 10.0pt;">      </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">         </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">         <span class="" style="font-family: 'Hack Regular';">para.</span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';">getContent</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">().add(run); </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 10.0pt;;font-family: 'Hack Regular';">// ContentAccessor</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      <span class="" style="font-family: 'Hack Regular';">}</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">      </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Hack Regular';">return</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> para;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   <span class="" style="font-family: 'Hack Regular';">}</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 4mm;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Notice that the paragraph, the run, and indeed the Body, all implement the </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Liberation Mono';">ContentAccessor</span><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">interface:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;;font-family: 'Liberation Mono';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> * </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F9FBF;font-size: 10.0pt;;font-family: 'Liberation Mono';">@since</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> 2.7</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> */</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Liberation Mono';">interface</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #000000;background-color: #D3D3D3;font-size: 10.0pt;;font-family: 'Liberation Mono';">ContentAccessor</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> {</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Liberation Mono';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> List&lt;Object&gt; getContent();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;">   </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Liberation Mono';">}</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">The add method adds the content at the end of the document.  If you want to insert it somewhere else, </span><span class="" style="font-family: 'Calibri Light';">you could use something like:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> org.docx4j.wml.P addParaAtIndex(MainDocumentPart mdp,</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">String simpleText, </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">int</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> index) {</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">org.docx4j.wml.ObjectFactory factory = Context.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 8.0pt;;font-family: 'Hack Regular';">getWmlObjectFactory</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">org.docx4j.wml.P para = factory.createP();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">if</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> (simpleText != </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">null</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">) {</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">org.docx4j.wml.Text t = factory.createText();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">t.setValue(simpleText);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">org.docx4j.wml.R run = factory.createR();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">run.getContent().add(t);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">para.getContent().add(run);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">}</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">mdp.getContent().add(index, para);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">return</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> para;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Hack Regular';">}</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">Alternatively, you can create the paragraph by marshalling XML:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Hack Regular';">// Assuming String xml contains the XML above</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.wml.P  para = XmlUtils.unmarshalString(xml);</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">For this to work, you need to ensure that all namespaces are declared properly in the string.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">See further below for adding images, and tables.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Ref273526076" /><a name="_Toc96591832" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">General strategy/approach for creating stuff</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">The first thing you need to know is what the XML you are trying to create looks like.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">To figure this out, start with a docx that contains the construct (create it in Word if necessary).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Now look at its XML. Choices:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">You can unzip it to do this </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">blagh</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">upload it to </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">the PartsList </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">online </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">webapp</span></a><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">(which can also generate code for you)</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">save it as Flat OPC XML from Word (or use the </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Liberation Mono';">ExportInPackageFormat</span><span style="font-family: 'Liberation Mono';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">sample),  so you have just a single XML file which you don't need to unzip</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">you can use the </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;">DisplayMainDocumentPartXml </span><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">to get it</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">you can open it with docx4all, and look at the source view</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">on Windows, if you have Visual Studio 2010, you can drag the docx onto it</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span class="DefaultParagraphFont " style="color: #000000;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">if you use Google</span><span class="" style="">’</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">s Chrome web browser, try </span></span><a href="https://chrome.google.com/webstore/detail/ooxml-viewer/bjmmjfdegplhkefakjkccocjanekbapn"><span class="Hyperlink DefaultParagraphFont " style="font-weight: bold;color: #0066DD;background-color: #F7F7F7;font-size: 9.0pt;;font-family: 'Liberation Sans';">OOXML Viewer for Chrome</span></a><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">.</span></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Now you are ready to create this XML using JAXB.  There are 2 basic ways.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">The classic JAXB way is to use the ObjectFactory's .createX methods.  For example:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">       </span><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;">ObjectFactory factory = Context.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 9.0pt;;font-family: 'Liberation Mono';">getWmlObjectFactory</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;">(); </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;">       P p = factory.createP();</span>   </span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">The challenge with this is to know what object it is you are trying to create.  To find this out, the easiest way by far is to use </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">the PartsList </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">online </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">webapp</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">.  Alternatively, you could run </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;">OpenMainDocumentAndTraverse </span><span class="" style="font-family: 'Calibri Light';">on your document, or use Eclipse to search the relevant schema (in /xsd) or source code.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Here are the names for some common objects:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <table class="TableGrid TableNormal " id="docx4j_tbl_4" style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 0.37in;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 5.12in;"><colgroup><col style="width: 19.22%;" /><col style="width: 17.31%;" /><col style="width: 32.36%;" /><col style="width: 31.11%;" /></colgroup><tbody><tr><td style="background-color: #D9D9D9;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">Object</span></p></td><td style="background-color: #D9D9D9;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">XML element</span></p></td><td style="background-color: #D9D9D9;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">docx4j class</span></p></td><td style="background-color: #D9D9D9;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">Factory method</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">Document body</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">w:body</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">org.docx4j.wml.Body</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">factory.createBody();</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">Paragraph</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">w:p</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">org.docx4j.wml.P</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">factory.createP()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">Paragraph props</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">w:pPr</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">org.docx4j.wml.PPr</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">factory.createPPr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">Run</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">w:r</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">org.docx4j.wml.R</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">factory.createR()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">Run props</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">w:rPr</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">org.docx4j.wml.RPr</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">factory.createRPr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">Text</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">w:t</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">org.docx4j.wml.Text</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">factory.createText()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">Table</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">w:tbl</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">org.docx4j.wml.Tbl</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">factory.createTbl()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">Table row</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">w:tr</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">org.docx4j.wml.Tr</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">factory.createTr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">Table cell</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">w:tc</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">org.docx4j.wml.Tc</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">factory.createTc()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">Drawing</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">w:drawing</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">org.docx4j.wml.Drawing</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">factory.createDrawing()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">Page break</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">w:br</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">org.docx4j.wml.Br</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">factory.createBr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">Footnote </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><br /><span class="" style="font-family: 'Calibri Light';">or endnote ref</span></span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">?</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">org.docx4j.wml.CTFtnEdnRef</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Calibri Light';">factory.createCTFtnEdnRef()</span></p></td></tr></tbody></table>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">An easier way to create stuff </span><span class="" style="font-family: 'Calibri Light';">may be to just unmarshal the  XML (eg a String representing a paragraph to be inserted into the document).</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">For example, given:</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&lt;</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;">w:p </span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;;font-family: 'Hack Regular';"> </span><span class="xmlmarkupattributename DefaultParagraphFont " style="color: #FF0000;font-size: 8.5pt;;font-family: 'Hack Regular';">xmlns:w</span><span class="xmlmarkupattributevalue DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">="http://schemas.openxmlformats.org/wordprocessingml/2006/main"</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><span class="" style="font-family: 'Hack Regular';">    </span></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&lt;</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Hack Regular';">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><span class="" style="font-family: 'Hack Regular';">        </span></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&lt;</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Hack Regular';">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;;font-family: 'Hack Regular';">Hello world</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&lt;/</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Hack Regular';">w:t</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><span class="" style="font-family: 'Hack Regular';">    </span></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&lt;/</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Hack Regular';">w:r</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.5pt;"><br /></span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&lt;/</span><span class="xmlmarkuptagname DefaultParagraphFont " style="color: #A31515;font-size: 8.5pt;;font-family: 'Hack Regular';">w:p</span><span class="xmlmarkupbracket DefaultParagraphFont " style="color: #0000FF;font-size: 8.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">you can simply:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Hack Regular';">// Assuming String xml contains the XML above</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.wml.P  para = XmlUtils.unmarshalString(xml);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #FFFF00; border-style:solid; border-width:1px;background-color: #FFFF00;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">The </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">PartsList </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">online </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">webapp</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> can generate appropriate code for you, using both of these approaches.  It also links to the Open XML spec documentation for the element.</span></p>
  
  <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #FFFF00; border-style:solid; border-width:1px;background-color: #FFFF00;"><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">Alternatively, you can install the </span><a href="http://www.plutext.com/dn/downloads/1441189231363/Docx4jHelper-1_0.exe"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">Docx4j Helper Word AddIn</span></a><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">, to generate code from within Word.  See also forum </span><a href="http://www.docx4java.org/forums/docx4jhelper-addin-f30/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">http://www.docx4java.org/forums/docx4jhelper-addin-f30/</span></a><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">If you need to be explicit about the type, you can use:</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">public static </span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">Object unmarshalString(String str, JAXBContext jc, Class declaredType)</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591833" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Formatting Properties</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Usually you format the appearance of things via an object</span><span class="" style="">’</span><span class="" style="font-family: 'Calibri Light';">s properties element:</span></p>
  
  <table class="TableGrid TableNormal " id="docx4j_tbl_5" style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 0.47in;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 101mm;"><colgroup><col style="width: 44.09%;" /><col style="width: 55.91%;" /></colgroup><tbody><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">Object</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">Method</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">Paragraph</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">P.getPPr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">Run</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">R.getRPr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">Table</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">Tbl.getTblPr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">Table row</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">Tr.getTrPr()</span></p></td></tr><tr><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">Table cell</span></p></td><td style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0mm;padding-left: 1.91mm;padding-right: 1.91mm;padding-top: 0mm;">
  
  <p class="Normal-TableGrid-BR DocDefaults "><span class="" style="font-family: 'Calibri Light';">Tc.getTcPr()</span></p></td></tr></tbody></table>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">In a docx, the appearance of text is basically determined by the style in the styles part which applies to it (styles can inherit from other styles), plus any direct formatting.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Docx4j contains code for working out the effective formatting, which is used in its PDF output.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">In XHTML import, docx4j converts CSS into formatting properties.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591834" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Creating and adding a table</span></p>
  
  <p class="Normal DocDefaults "><a href="http://dev.plutext.org/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/model/table/TblFactory.java"><span style="font-family: 'Calibri Light';">org.docx4j.model.table.TblFactory</span></a><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">provides an easy way to create a simple table. For an example of its use, see the </span><a href="http://dev.plutext.org/trac/docx4j/browser/trunk/docx4j/src/main/java/org/docx4j/samples/CreateWordprocessingMLDocument.java"><span style="font-family: 'Calibri Light';">CreateWordprocessingMLDocument sample</span></a><span style="font-family: 'Calibri Light';">.</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">If you want to add </span><span style="font-family: 'Calibri Light';">content</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">, see </span><a href="#_Ref273526076"><span class="DefaultParagraphFont " style="font-weight: bold;font-style: italic;;font-family: 'Calibri Light';">General strategy/approach for creating stuff</span></a><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">above.</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span style="font-family: 'Calibri Light';">If you want format your table (make it prettier), see Formatting Properties immediately above.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Or you can use the </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">PartsList </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">online </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">webapp</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> to generate the code.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">If you are looking to fill table rows with data, consider OpenDoPE content control data binding (in which you </span><span class="" style="">“</span><span class="" style="font-family: 'Calibri Light';">repeat</span><span class="" style="">” </span><span class="" style="font-family: 'Calibri Light';">a table row).</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591835" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';white-space:pre-wrap;">Selecting your insertion/editing point; </span><span class="DefaultParagraphFont "><br /><span class="" style="font-family: 'Liberation Serif';">accessing JAXB nodes via XPath</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">Sometimes, XPath is a succinct way to select the things you need to change.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">You</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> can use XPath to select JAXB nodes:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Hack Regular';">MainDocumentPart documentPart = wordMLPackage.getMainDocumentPart();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">String xpath = </span></span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">"//w:p"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">;</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">List&lt;Object&gt; list = documentPart.getJAXBNodesViaXPath(xpath, </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">false</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">);</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">These JAXB nodes are live, in the sense that if you change them, your document changes.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">There are a few limitations however</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> in the JAXB reference implementation: </span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">the xpath expressions are evaluated against the XML document as it was when first opened in docx4j.  You can update the associated XML document once only, by passing true into </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">getJAXBNodesViaXPath</span><span style="font-family: 'Calibri Light';">. Updating it again (with current JAXB 2.1.x or 2.2.x) will cause an error.</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span style="font-family: 'Calibri Light';">For some document</span><span style="font-family: 'Calibri Light';">s</span><span style="font-family: 'Calibri Light';">, JAXB can</span><span>’</span><span style="font-family: 'Calibri Light';">t set up the XPath</span></li></ul>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">If these limitations are causing you problems, try using MOXy as your JAXB implementation, or see Traversing immediately </span><span class="" style="font-family: 'Calibri Light';">below for a different approach.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591836" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Traversing a document</span></p>
  
  <p class="Normal DocDefaults "><a href="https://github.com/plutext/docx4j/blob/master/src/main/java/org/docx4j/samples/OpenMainDocumentAndTraverse.java"><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri Light';">OpenMainDocumentAndTraverse.java</span></a><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">in the samples directory shows you how to traverse the JAXB representation of a docx.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">This is an alternative to XSLT, which doesn't require marshalling</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> to a DOM document and </span><span class="" style="font-family: 'Calibri Light';">unmarshalling</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> again</span><span class="" style="font-family: 'Calibri Light';">.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">The sample uses TraversalUtil, which is a general approach for traversing the JAXB object tree in the main document part.  It can also be applied to headers, footers etc.   TraversalUtil has an </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">interface</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> Callback, </span></span><span class="" style="font-family: 'Calibri Light';">which you use to specify how you want to traverse the nodes, and what you want to do to them.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">As noted earlier,</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> many objects (eg the document body, a paragraph, a run), have a List containing their content.  Traversal works by iterating over these lists. </span></p>
  
  <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #FFFF00; border-style:solid; border-width:1px;background-color: #FFFF00;"><span class="DefaultParagraphFont " style="background-color: #FFFF00;;font-family: 'Calibri Light';">Traversing is a very useful approach</span><span class="DefaultParagraphFont " style="background-color: #FFFF00;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> for finding and altering parts of the document.</span></span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">For example, it is used in docx4j 2.8.0, to provide a way of producing HTML output without using XSLT/Xalan.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">The </span><a href="https://github.com/plutext/docx4j/tree/master/src/main/java/org/docx4j/finders"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">org.docx4j.finders</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> package contains classes which make it convenient to find various objects.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">It is often superior to using XPath (owing to the limitations in the JAXB reference implementation noted above).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Note also, in </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Hack Regular';">package</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> org.docx4j.utils:</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">/** </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> * Use this if there is only a single object type (</span></span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;text-decoration: underline;;font-family: 'Hack Regular';">eg</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> just P's)</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> * you are interested in doing something with.</span></span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Hack Regular';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Hack Regular';">class</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> SingleTraversalUtilVisitorCallback </span></span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">ImageConvertEmbeddedToLinked sample contains an example of the use of the above.</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">/** </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> * Use this if there is more than one object type (</span></span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;text-decoration: underline;;font-family: 'Hack Regular';">eg</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> Tables and Paragraphs)</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 10.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> * you are interested in doing something with during the traversal.</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Hack Regular';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 10.0pt;;font-family: 'Hack Regular';">class</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> CompoundTraversalUtilVisitorCallback </span></span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Ref275255216" /><a name="_Toc96591837" /><span style="font-family: 'Liberation Serif';">Adding a Part</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">What if you wanted to add a new styles part? Here's how:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Hack Regular';">// Create a styles part</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">StyleDefinitionsPart stylesPart = </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">new </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">StyleDefinitionsPart();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Hack Regular';">// Populate it with default styles</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">stylesPart.unmarshalDefaultStyles();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">      </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Hack Regular';">// Add the styles part to the main document part relationships</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">wordDocumentPart.addTargetPart(stylesPart);</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">You'd take the same approach to add a header or footer.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">When you add a part this way, it is automatically added to the source part's relationships part.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">Generally, you'll also need to add a reference to the part (using its relationship id) to the Main Document Part.  This applies to images, headers and footers. (Comments, footnotes and endnotes are a bit different, in that what you add to the main document part are references to individual comments/footnotes/endnotes).</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591838" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Importing XHTML</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">docx4j can convert XHTML content (paragraphs, tables, images) into native WordML, reproducing much of the formatting.</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  </span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';">From v3, the XHTML Import functionality is a</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';"> </span><a href="https://github.com/plutext/docx4j-ImportXHTML"><span class="Hyperlink DefaultParagraphFont " style="color: #B85B5A;font-size: 11.0pt;;font-family: 'Calibri Light';">separate project on GitHub</span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';" /><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';">.</span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';">The reason being that its main dependency – Flying Saucer - is licensed under LGPL v2.1 (as opposed to ASL v2, which docx4j’s other dependencies use).</span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="border-color: #FFFFFF; border-style:solid; border-width:1px;background-color: #FFFFFF;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';">If you want this functionality, you have to add these jars to your classpath.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">See the samples at </span><a href="https://github.com/plutext/docx4j-ImportXHTML/tree/master/src/samples"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://github.com/plutext/docx4j-ImportXHTML/tree/master/src/samples</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591839" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">docx to (X)HTML</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">docx4j can convert a docx to HTML or XHTML.  </span><span class="" style="font-family: 'Calibri Light';">You will find the generated HTML is clean</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> (in comparison to the HTML Word produces)</span><span class="" style="font-family: 'Calibri Light';">.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">Docx4j</span><span class="" style="">’</span><span class="" style="font-family: 'Calibri Light';">s HTML output is suitable for documents which contain paragraphs, tables and images.  It can</span><span class="" style="">’</span><span class="" style="font-family: 'Calibri Light';">t handle more exotic features, such as equations, SmartArt, or WordArt (DrawingML or VML).</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">Elsewhere on the web, you</span><span class="" style="">’</span><span class="" style="font-family: 'Calibri Light';">ll find XSLT which can convert docx to HTML.  That XSLT is very complex, since it has to derive effective formatting from the hierarchy.</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">In contrast, in docx4j, that logic is implemented in Java.  Because of this, docx4j</span><span class="" style="">’</span><span class="" style="font-family: 'Calibri Light';">s XSLT is simple (Java XSLT extension functions do the heavy lifting).</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">In docx4j, you can create output using XSLT, or by traversing the document in Java.</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  The façade lets you specify which:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">//Prefer the exporter, that uses a </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">xsl</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> transformation</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">Docx4J.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 8.0pt;;font-family: 'Hack Regular';">toHTML</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">(htmlSettings, os, Docx4J.</span><span class="DefaultParagraphFont " style="color: #0000C0;font-style: italic;font-size: 8.0pt;;font-family: 'Hack Regular';">FLAG_EXPORT_PREFER_XSL</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">//Prefer the exporter, that doesn't use a </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">xsl</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> transformation (= uses a visitor)</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">//</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">Docx4J.toHTML(htmlSettings, </span></span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">os</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">, Docx4J.FLAG_EXPORT_PREFER_NONXSL);</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">See the sample on GitHub at </span><a href="https://github.com/plutext/docx4j/blob/master/src/samples/docx4j/org/docx4j/samples/ConvertOutHtml.java"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">src/samples/docx4j/org/docx4j/samples/ConvertOutHtml.java</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">If you have output logging enabled, anything which is not implemented will be obvious in the output document.  </span><span class="DefaultParagraphFont " style="font-weight: bold;font-style: italic;;font-family: 'Calibri Light';">If debug level logging is not switched on, unsupported elements will be silently dropped.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591840" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">docx to PDF</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">docx4j facilitates 3 distinct ways to convert Microsoft Word docx documents to PDF. There are also possibilities for converting pptx or xlsx to PDF.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">The three approaches:</span></p><ol>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">export-fo: the content is converted to XSL FO, and from there, to PDF (or any of the other formats supported by Apache FOP)</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">documents4j: since 8.2.0, use Microsoft Word to do the conversion</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">via-Microsoft-Graph: new in 8.2.3, use java-docx-to-pdf-using-Microsoft-Graph to do the conversion</span></li></ol>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">So which should you choose? The following table covers some of the things you might want to consider:</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style=""><img height="437" id="rId60" src="Docx4j_GettingStarted.docx_files/fd47514a-f333-4f6f-baa1-037fd7a0bbb6image1.png" width="451" /></span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Best results are achieved using Microsoft Graph or if Microsoft Word is available -locally or remotely - to perform the conversion.  If this is the case, you can put </span><span class="" style="font-family: 'Calibri Light';">docx4j-documents4j-local</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  or </span><span class="" style="font-family: 'Calibri Light';">docx4j-documents4j-remote</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> on your classpath</span><span class="" style="font-family: 'Calibri Light';">, and rely on Microsoft Word to do the conversion.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Note: For a period to 2019, Plutext offered a commercial PDF Converter.  That product is no longer available.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">T</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">he Docx4J facade can be used </span><span class="" style="font-family: 'Calibri Light';">to convert to PDF:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">static</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">void</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> toPDF(WordprocessingMLPackage </span></span><span class="DefaultParagraphFont " style="color: #6A3E3E;background-color: #FFFF00;font-size: 8.0pt;;font-family: 'Hack Regular';">wmlPackage</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">, OutputStream </span><span class="DefaultParagraphFont " style="color: #6A3E3E;font-size: 8.0pt;;font-family: 'Hack Regular';">outputStream</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">) </span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;text-indent: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">throws</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> Docx4JException </span></span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">It uses the first implementation it finds, in the following order:</span></p><ul><ul><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">pdf</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';">Via</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';">Documents4jRemote</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">pdf</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';">Via</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';">Documents4jLocal</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">pdf</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';">Via</span><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';">FO</span></li></ul></ul></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">The façade can't use Microsoft Graph at this time.  If you want to use that, do so directly (see below).</span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc96591841" /><span style="font-family: 'Liberation Serif';">docx/pptx/xlsx</span><span style="font-family: 'Liberation Serif';white-space:pre-wrap;"> </span><span style="font-family: 'Liberation Serif';white-space:pre-wrap;">to PDF via </span><span style="font-family: 'Liberation Serif';">Documents4j (using Word)</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">With this approach, you need Word installed, either locally or remotely.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">For background, see generally </span><a href="https://documents4j.com/#/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://documents4j.com/#/</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">For use in the context of docx4j:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">for the local case:  </span><a href="https://github.com/plutext/docx4j/tree/master/docx4j-samples-documents4j-local/src/main/java/org/docx4j/samples/documents4j/local"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://github.com/plutext/docx4j/tree/master/docx4j-samples-documents4j-local/src/main/java/org/docx4j/samples/documents4j/local</span></a></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">for the remote case: </span><a href="https://github.com/plutext/docx4j/blob/master/docx4j-samples-documents4j-remote/README.txt"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://github.com/plutext/docx4j/blob/master/docx4j-samples-documents4j-remote/README.txt</span></a><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">and </span><a href="https://github.com/plutext/docx4j/tree/master/docx4j-samples-documents4j-remote/src/main/java/org/docx4j/samples/documents4j/remote"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://github.com/plutext/docx4j/tree/master/docx4j-samples-documents4j-remote/src/main/java/org/docx4j/samples/documents4j/remote</span></a></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Regarding TOC update, see </span><a href="https://www.docx4java.org/blog/2020/03/documents4j-for-toc-update/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://www.docx4java.org/blog/2020/03/documents4j-for-toc-update/</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc96591842" /><span style="font-family: 'Liberation Serif';">docx</span><span style="font-family: 'Liberation Serif';">/pptx/xlsx</span><span style="font-family: 'Liberation Serif';white-space:pre-wrap;"> to PDF via </span><span style="font-family: 'Liberation Serif';">Microsoft Graph</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">See generally </span><a href="https://github.com/plutext/java-docx-to-pdf-using-Microsoft-Graph"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://github.com/plutext/java-docx-to-pdf-using-Microsoft-Graph</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> and </span><a href="https://github.com/plutext/docx4j/tree/master/docx4j-samples-conversion-via-microsoft-graph/src/main/java/org/docx4j/samples/graph_convert"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://github.com/plutext/docx4j/tree/master/docx4j-samples-conversion-via-microsoft-graph/src/main/java/org/docx4j/samples/graph_convert</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc96591843" /><span style="font-family: 'Liberation Serif';">docx to PDF</span><span style="font-family: 'Liberation Serif';white-space:pre-wrap;"> via XSL FO</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">If Word is not available, you can generate PDF output via XSL FO using FOP.  If you want to use the existing XSL FO + Apache FOP PDF Conversion, just add docx4j-export-fo (+ deps) to your classpath.  If docx4j detects that they are present, it will revert to </span><span class="" style="font-family: 'Calibri Light';">this</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> FO based conversion.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">See the sample code at </span><a href="https://github.com/plutext/docx4j/blob/master/docx4j-samples-docx-export-fo/src/main/java/org/docx4j/samples/ConvertOutPDFviaXSLFO.java"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://github.com/plutext/docx4j/blob/master/docx4j-samples-docx-export-fo/src/main/java/org/docx4j/samples/ConvertOutPDFviaXSLFO.java</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Configure hyphenation at </span><a href="https://github.com/plutext/docx4j/blob/master/docx4j-samples-resources/src/main/resources/docx4j.properties#L115"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://github.com/plutext/docx4j/blob/master/docx4j-samples-resources/src/main/resources/docx4j.properties#L115</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">These jars are in the zip file, in dir optional/export-fo  </span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591844" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Image Handling</span><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';white-space:pre-wrap;"> - DOCX</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">When you add an image to a document in Word 2007, it is generally added as a new Part (ie you'll find a part in the resulting docx, containing the image in base 64 format).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">When you open the document in docx4j, docx4j will create an image part representing it.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">It is also possible to create a </span><span class="" style="">“</span><span class="" style="font-family: 'Calibri Light';">linked</span><span class="" style="">” </span><span class="" style="font-family: 'Calibri Light';">image.  In this case, the image is not embedded in the docx package, but rather, is referenced at its external location.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Docx4j's </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';">BinaryPartAbstractImage</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri Light';">class contains methods to allow you to create both embedded and linked images (along with appropriate relationships).</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">* Create an image part from the provided byte array, attach it to the </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">* main document part, and return it.*/</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">public static </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">BinaryPartAbstractImage createImagePart(WordprocessingMLPackage wordMLPackage,</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">      </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';">byte</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">[] bytes) </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">  </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">* Create an image part from the provided byte array, attach it to the source part</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">* (eg the main document part, a header part etc), and return it.*/</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">public static </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">BinaryPartAbstractImage createImagePart(WordprocessingMLPackage wordMLPackage,</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">      </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">Part sourcePart, </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';">byte</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">[] bytes) </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">* Create a linked image part, and attach it as a rel of the specified source part</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">* (eg a header part)</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">*/</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">public static </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">BinaryPartAbstractImage createLinkedImagePart(</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">      </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">WordprocessingMLPackage wordMLPackage, Part sourcePart, String fileurl) </span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">For an image to appear in the document, there also needs to be appropriate XML in the main document part.  This XML can take 2 basic forms:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;margin-bottom: 0in;line-height: 100%;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">the Word 2007 </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;;font-family: 'Hack Regular';">w:drawing</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';">form</span></li></ul>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 9.0pt;">   </span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">&lt;w:p&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;w:r&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">         <span class="" style="font-family: 'Hack Regular';">&lt;w:drawing&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">            <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">&lt;wp:inline </span></span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">distT</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">="0" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">distB</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">="0" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">distL</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">="0" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">distR</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">="0"</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">&lt;wp:extent </span></span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">cx</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">="3238500" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">cy</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">="2362200" /</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">&lt;wp:effectExtent </span></span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">l</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">="19050" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">t</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">="0" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">r</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">="0" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">b</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">="0" /</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Hack Regular';">:</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Hack Regular';">&lt;a:graphic &gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                  <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">&lt;a:graphicData </span></span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> ..</span></span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                     <span class="" style="font-family: 'Hack Regular';">&lt;pic:pic &gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                        <span class="" style="font-family: 'Hack Regular';">:</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                        <span class="" style="font-family: 'Hack Regular';">&lt;pic:blipFill&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                           <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">a:blip </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">r:embed</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">="rId5"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> /</span></span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                           <span class="" style="font-family: 'Hack Regular';">:</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                        <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">pic:blipFill&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                        <span class="" style="font-family: 'Hack Regular';">:</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                     <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">pic:pic&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                  <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">a:graphicData&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">a:graphic&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">            <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">wp:inline&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">         <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">w:drawing&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">w:r&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">   <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">w:p&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">the Word 2003 VML-based </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;;font-family: 'Hack Regular';">w:pict</span><span style="font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">form</span></li></ul>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">   </span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">&lt;w:p&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;w:r&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">         <span class="" style="font-family: 'Hack Regular';">&lt;w:pict&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">            <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">&lt;v:shapetype </span></span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">id</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">="_x0000_t75" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">coordsize</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">="21600,21600" </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> .. </span></span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">&lt;v:stroke </span></span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">joinstyle</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">="miter" /</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Hack Regular';">&lt;v:formulas&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">                  <span class="" style="font-family: 'Hack Regular';">:</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">v:formulas&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Hack Regular';">:</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">            <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">v:shapetype&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">            <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">&lt;v:shape </span></span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">..</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">style</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">="width:428.25pt;height:321pt"</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">               <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">v:imagedata </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">r:id</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">="rId4"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 9.0pt;;font-family: 'Hack Regular';">o:title</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">="" /</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;">            <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 9.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';">v:shape&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 12.0pt;">         </span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Hack Regular';">&lt;</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Hack Regular';">w:pict&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Hack Regular';">w:r&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">   <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Hack Regular';">w:p&gt;</span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Docx4j can create the Word 2007 </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;;font-family: 'Hack Regular';">w:drawing/wp:inline</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri Light';">form for you:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">* Create a </span><span class="DefaultParagraphFont " style="color: #7F7F9F;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">&lt;wp:inline&gt; </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">element suitable for this image,</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">* which can be linked or embedded in w:p/w:r/w:drawing.</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">* If the image is wider than the page, it will be scaled</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">* automatically.  See Javadoc for other signatures.</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">* </span><span class="DefaultParagraphFont " style="color: #7F9FBF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">@param </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">filenameHint Any text, for example the original filename</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">* </span><span class="DefaultParagraphFont " style="color: #7F9FBF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">@param </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">altText  Like HTML's alt text</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">* </span><span class="DefaultParagraphFont " style="color: #7F9FBF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">@param </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">id1   An id unique in the document</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">* </span><span class="DefaultParagraphFont " style="color: #7F9FBF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">@param </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">id2   Another id unique in the document</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">* </span><span class="DefaultParagraphFont " style="color: #7F9FBF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">@param </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">link</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  true if this is to be </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">linked not embedded</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">*/</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">public </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">Inline createImageInline(String filenameHint, String altText, </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">      </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">int </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">id1, </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">int </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">id2, </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">boolean </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">link) </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">which you can then add to a </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;;font-family: 'Hack Regular';">w:r/w:drawing.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Finally, with docx4j, you can convert images from formats unsupported by Word (eg PDF), to PNG, which is a supported format.  For this, docx4j uses </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">ImageMagick</span><span class="" style="font-family: 'Calibri Light';">.  So if you want to use this feature, you need to install ImageMagick.  Docx4j invokes ImageMagick using:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">Process p = Runtime.getRuntime().exec(</span></span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">"imconvert -density " </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">+ density + </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">" -units PixelsPerInch - png:-"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">);</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><br /></span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Note the name </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">imconvert</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">, which is used so that we don't have to supply a full path to exec.  You'll need to accommodate that.  </span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591845" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Manual Image Manipulation</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Images involve three things:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">the image part itself</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">a relationship, in the relationships part of the main document part (or header part etc).  This relationship includes:</span></li><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">the name of the image part (for example, </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">/word/media/image1.jpeg</span><span style="font-family: 'Calibri Light';">)</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">the relationship ID</span></li></ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">some XML in the main document part (or header part etc), referencing the relationship ID (see </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;;font-family: 'Hack Regular';">w:drawing</span><span style="font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">and </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #800000;;font-family: 'Hack Regular';">w:pict</span><span style="font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">examples above)</span></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">This means that if you are moving images around, you need to take care to ensure that the relationships remain valid. </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">You can manually manipulate the relationship, and you can manually manipulate the XML referencing the relationship IDs.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Given an image part, you can get the relationship pointing to it </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">Relationship </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">rel = copiedImagePart.getSourceRelationship();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">String id = rel.getId();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">You can then ensure the reference matches.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591846" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Image Handling – PPTX</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">See the pptx4j </span><a href="https://github.com/plutext/docx4j/blob/master/src/pptx4j/java/org/pptx4j/samples/InsertPicture.java"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">InsertPicture</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> sample.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591847" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Adding Headers/Footers</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">See the HeaderFooter sample for how to do this.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591848" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Protection Settings</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">There is a family of features the Office UI groups under </span><span class="" style="">“</span><span class="" style="font-family: 'Calibri Light';">Protection Settings</span><span class="" style="">”</span><span class="" style="font-family: 'Calibri Light';">. These include:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">mark as final</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">encrypt with password</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">digital signatures</span></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Most protection settings can be manipulated using docx4j 3.3.  It contains a class ProtectionSettings:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Hack Regular';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> * The Protection Settings which are common across</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> * </span></span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">docx</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">, </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">pptx</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">, </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">xlsx</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Hack Regular';">, namely mark as final, encrypt with password,</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> * and digital signature.  Subclasses implement the </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> * </span></span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">docx</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> and </span></span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">xlsx</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> format specific features.</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> * </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> * </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F9FBF;font-size: 8.0pt;;font-family: 'Hack Regular';">@author</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">jharrop</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> * </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F9FBF;font-size: 8.0pt;;font-family: 'Hack Regular';">@since</span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> 3.3.0</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> */</span></span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">abstract</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">class</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> ProtectionSettings</span></span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">The relevant subclass is accessed via the package object:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">WordprocessingMLPackage</span><span style="font-family: 'Calibri Light';">:</span><br /><br /><span style="font-family: 'Calibri Light';">ProtectDocument getProtectionSettings()</span><br /></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">PresentationMLPackage</span><br /><br /><span style="font-family: 'Calibri Light';">ProtectPresentation getProtectionSettings()</span><br /></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">SpreadsheetMLPackage</span><br /><br /><span style="font-family: 'Calibri Light';">ProtectWorkbook getProtectionSettings()</span></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Note: support for digital signatures is in Plutext</span><span class="" style="">’</span><span class="" style="font-family: 'Calibri Light';">s Enterprise edition.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591849" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';white-space:pre-wrap;">docx </span><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Table of Contents</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">D</span><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';white-space:pre-wrap;">ocx4j (from v3.3.0) can generate/update a ToC, including update its page numbers.  </span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">In docx4j v8.2.0, this can be done in 2 distinct ways: (1) by automating Microsoft Word using documents4j (new in v8.2.0) or, (2) in pure Java (albeit with possible inaccuracy in the page numbers).</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';white-space:pre-wrap;">For the documents4j approach, please see </span><a href="https://github.com/plutext/docx4j/blob/VERSION_8_2_0/docx4j-samples-documents4j-local/src/main/java/org/docx4j/samples/documents4j/local/TocOperations.java"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://github.com/plutext/docx4j/blob/VERSION_8_2_0/docx4j-samples-documents4j-local/src/main/java/org/docx4j/samples/documents4j/local/TocOperations.java</span></a><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">That example is for Word running locally.  If you run Word remotely, please see the comments at </span><a href="https://github.com/plutext/docx4j/blob/VERSION_8_2_0/docx4j-documents4j-remote/src/main/java/org/docx4j/documents4j/remote/Documents4jRemoteServices.java#L61"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://github.com/plutext/docx4j/blob/VERSION_8_2_0/docx4j-documents4j-remote/src/main/java/org/docx4j/documents4j/remote/Documents4jRemoteServices.java#L61</span></a><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">The "pure Java" approach uses export-fo.  For an example using this approach, please see </span><a href="https://github.com/plutext/docx4j/blob/VERSION_8_2_0/docx4j-samples-docx4j/src/main/java/org/docx4j/samples/TocSample.java"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">https://github.com/plutext/docx4j/blob/VERSION_8_2_0/docx4j-samples-docx4j/src/main/java/org/docx4j/samples/TocSample.java</span></a><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc403733683" /><a name="_Toc96591850" /><span style="font-family: 'Liberation Serif';">Introduction</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">A table of contents is often included in a docx file.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Where docx4j or other code is used to modify the document, the TOC may need updating since page numbers may be wrong, or entries added, deleted or modified.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">In some cases, it is sufficient to leave the TOC updating until the docx is opened in Microsoft Word.  In Word, the user can manually issue the command to update the table.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">In other scenarios, it is desirable to update the TOC programmatically.  For example, prior to PDF output.  </span><span class="" style="font-family: 'Calibri Light';">The samples above show the 2 approaches docx4j offers for doing this.</span></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc403733684" /><a name="_Toc96591851" /><span style="font-family: 'Liberation Serif';">Field background</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Historically, Word has used a </span><span class="DefaultParagraphFont " style="font-style: italic;;font-family: 'Calibri Light';">field code</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> to specify a table of contents.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">A table of contents field is just one type of field, amongst many:</span></p>
  
  <p class="Grammar Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">date-and-time:</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">CREATEDATE</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">DATE</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">EDITTIME</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">PRINTDATE</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">SAVEDATE</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">TIME</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  </span></p>
  
  <p class="Grammar Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">document-automation:</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">COMPARE</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">DOCVARIABLE</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">GOTOBUTTON</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">IF</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">MACROBUTTON</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">PRINT</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  </span></p>
  
  <p class="Grammar Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">document-information:</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">AUTHOR</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">COMMENTS</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">DOCPROPERTY</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">FILENAME</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">FILESIZE</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">INFO</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">|  </span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">KEYWORDS</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">LASTSAVEDBY</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">NUMCHARS</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">NUMPAGES</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">NUMWORDS</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">SUBJECT</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">|  </span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">TEMPLATE</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">TITLE</span></p>
  
  <p class="Grammar Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">equations-and-formulas:</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">= formula  |  </span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">ADVANCE</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">EQ</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">SYMBOL</span></p>
  
  <p class="Grammar Normal DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">index-and-tables:</span><span class="DefaultParagraphFont " style="font-weight: bold;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">INDEX</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">RD</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">TA</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">TC</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">TOA</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-weight: bold;text-decoration: underline;;font-family: 'Calibri Light';">TOC</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">|  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">XE</span></p>
  
  <p class="Grammar Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">links-and-references:</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">AUTOTEXT</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">AUTOTEXTLIST</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">BIBLIOGRAPHY</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">CITATION</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">HYPERLINK</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  INCLUDEPICTURE  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">INCLUDETEXT</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">|  </span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">LINK</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">NOTEREF</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">PAGEREF</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">QUOTE</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">REF</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">STYLEREF</span></p>
  
  <p class="Grammar Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">mail-merge:</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">ADDRESSBLOCK</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">ASK</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">COMPARE</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">DATABASE</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">FILLIN</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">GREETINGLINE</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">IF</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">|  </span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">MERGEFIELD</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">MERGEREC</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">MERGESEQ</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">NEXT</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">NEXTIF</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">SET</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">SKIPIF</span></p>
  
  <p class="Grammar Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">numbering:</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">AUTONUM</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">AUTONUMLGL</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">AUTONUMOUT</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">BARCODE</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">LISTNUM</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">PAGE</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">REVNUM</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">|  </span></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">SECTION</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">SECTIONPAGES</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">SEQ</span></p>
  
  <p class="Grammar Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">user-information:</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">USERADDRESS</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">USERINITIALS</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  |  </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">USERNAME</span></p>
  
  <p class="Grammar Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">form-field:</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">FORMCHECKBOX</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;"> | </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">FORMDROPDOWN</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;"> | </span><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">FORMTEXT</span></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc403733685" /><a name="_Toc96591852" /><span style="font-family: 'Liberation Serif';">TOC Content Control</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">Since the introduction of content controls in Word 2007, Word (References &gt; Table of Contents) inserts the TOC field in a content control:</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style=""><img height="171" id="rId74" src="Docx4j_GettingStarted.docx_files/fd47514a-f333-4f6f-baa1-037fd7a0bbb6image2.png" width="468" /></span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">When inserting a TOC, both approaches documented here </span><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">insert it in a content control.</span></p>
  
  <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #E36C0A;border-right-style: solid;border-right-width: 1px;border-right-color: #E36C0A;"><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">When updating a TOC, the pure Java approach </span><span class="DefaultParagraphFont " style=""><span class="" style="font-family: 'Calibri Light';">assumes the TOC is located in such a content control.   It won</span><span class="" style="">’</span><span class="" style="font-family: 'Calibri Light';">t find the TOC field unless it is.</span></span></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc403733686" /><a name="_Toc96591853" /><span style="font-family: 'Liberation Serif';">TOC Field Syntax</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">The TOC field instruction has the following components:</span></p>
  
  <p class="Grammar Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">TOC </span><br /><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /><span class="" style="font-family: 'Calibri Light';">field-argument</span><br /><span class="" style="font-family: 'Calibri Light';">switches</span><br /><span class="" style="font-family: 'Calibri Light';">field-argument   switches</span><br /><span class="" style="font-family: 'Calibri Light';">switches   field-argument</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">The TOC field supports </span><span class="" style="font-family: 'Calibri Light';">a variety of field-specific-switches.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">For example:</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">TOC \o "3-3" \h \z \t  "Heading 1,1,Heading 2,2,Appendix 1,1,Appendix 2,2" </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Of the switches in the Open XML specification, this TOC helper recognises:</span></p>
  
  <table id="docx4j_tbl_6" style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 13mm;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 78%;"><colgroup><col style="width: 15.18%;" /><col style="width: 84.82%;" /></colgroup><tbody><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">\h</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">Makes the table of contents entries hyperlinks.</span></p></td></tr><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">\n</span><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;"> field-argument</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">Without field-argument, omits page numbers from the table of contents. Page numbers are omitted from all levels unless a range of entry levels is specified by text in this switch's field-argument. A range is specified as for \l.</span></p></td></tr><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">\o</span><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;"> field-argument</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">Uses paragraphs formatted with all or the specified range of built-in heading styles. Headings in a style range are specified by text in this switch's field-argument using the notation specified as for \l, where each integer corresponds to the style with a style ID of HeadingX (e.g. 1 corresponds to Heading1). If no heading range is specified, all heading levels used in the document are listed.</span></p></td></tr><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">\t</span><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;"> field-argument</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">Uses paragraphs formatted with styles other than the built-in heading styles. text in this switch's field-argument specifies those styles as a set of comma-separated doublets, with each doublet being a comma-separated set of style name and table of content level. \t can be combined with \o.</span></p></td></tr><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">\u</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">Uses the applied paragraph outline level.</span></p></td></tr></tbody></table>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">The following switches may also be supported in a future version:</span></p>
  
  <table id="docx4j_tbl_7" style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 13mm;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 78%;"><colgroup><col style="width: 15.18%;" /><col style="width: 84.82%;" /></colgroup><tbody><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">\b field-argument</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">Includes entries only from the portion of the document marked by </span><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">the bookmark named by text in this switch's field-argument.</span></p></td></tr><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">\p field-argument</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">text in this switch's field-argument specifies a sequence of characters that separate an entry and its page number. The default is a tab with leader dots.</span></p></td></tr><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">\w</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">Preserves tab entries within table entries.</span></p></td></tr><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">\x</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-family: 'Calibri Light';">Preserves newline characters within table entries.</span></p></td></tr></tbody></table>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">There are no plans to support the remaining switches:</span></p>
  
  <table id="docx4j_tbl_8" style="border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;position: relative; margin-left: 13mm;table-layout: fixed;vertical-align: top;border-collapse: collapse;width: 78%;"><colgroup><col style="width: 15.18%;" /><col style="width: 84.82%;" /></colgroup><tbody><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">\a field-argument</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">Includes captioned items, but omits caption labels and numbers. The identifier designated by text in this switch's field-argument corresponds to the caption label.</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">Use \c to build a table of captions with labels and numbers.</span></p></td></tr><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">\c field-argument</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">Includes figures, tables, charts, and other items that are numbered by a SEQ field. The sequence identifier designated by text in this switch's field-argument, which corresponds to the caption label, shall match the identifier in the corresponding SEQ field.</span></p></td></tr><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">\d field-argument</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">When used with \s, the text in this switch's field-argument defines the separator between sequence and page numbers. The default separator is a hyphen (-).</span></p></td></tr><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">\f field-argument</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">Includes only those TC fields whose identifier exactly matches the text in this switch's field-argument (which is typically a letter).</span></p></td></tr><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">\l field-argument</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">Includes TC fields that assign entries to one of the levels specified by text in this switch's field-argument as a range having the form startLevel-endLevel, where startLevel and endLevel are integers, and startLevel has a value equal-to or less-than endLevel. TC fields that assign entries to lower levels are skipped.</span></p></td></tr><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">\s field-argument</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">For entries numbered with a SEQ field, adds a prefix to the page number. The prefix depends on the type of entry. text in this switch's field-argument shall match the identifier in the SEQ field.</span></p></td></tr><tr><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">\z</span></p></td><td style="background-color: #FFFFFF;border-bottom-style: solid;border-bottom-width: 1px;border-bottom-color: #000000;border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-top-style: solid;border-top-width: 1px;border-top-color: #000000;padding-bottom: 0.76mm;padding-left: 2.03mm;padding-right: 2.03mm;padding-top: 0.76mm;">
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">Hides tab leader and page numbers in Web layout view.</span></p></td></tr></tbody></table>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc403733687" /><a name="_Toc96591854" /><span style="font-family: 'Liberation Serif';">Inserting/generating a TOC</span><span style="font-family: 'Liberation Serif';white-space:pre-wrap;"> – "pure Java" considerations</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">You should ensure styles TOC1, TOC2, TOC3 etc are defined in your styles definition part, since these are used to style TOC entries.  ToC Helper will fallback to hard coded defaults for these styles, if they are not defined.  The hard coded defaults come from:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Hack Regular';">InputStream is = ResourceUtils.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 8.0pt;;font-family: 'Hack Regular';">getResourceViaProperty</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">( </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><br />            </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">"org.docx4j.toc.TocStyles.xml"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">,</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">            </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">"org/docx4j/toc/TocStyles.xml"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">You can specify a different resource of your own in docx4j.properties:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"># Defaults to </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">com/plutext/docx/toc/TocStyles.xml</span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"># It provides default </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">toc</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> style definitions,</span></span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"># for use if none are defined in the </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">docx</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> itself.</span></span></p>
  
  <p class="Normal DocDefaults " style="position: relative; margin-left: 0.5in;margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">org.docx4j.toc.TocStyles.xml=org/docx4j/toc/TocStyles.xml</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591855" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Text extraction</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">A quick way to extract the text from a docx, is to use </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">TextUtils</span><span class="" style="">‘  </span></span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">public static void </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">extractText(Object o, Writer w)</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">which marshals the object it is passed via a SAX ContentHandler, in order to output the text to the Writer.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591856" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Text substitution</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Text substitution is easy enough, provided the string you are searching for is represented in a </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';white-space:pre-wrap;">org.docx4j.wml.Text </span><span class="" style="font-family: 'Calibri Light';">object in the form you expect.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">However, that won't necessarily be the case.  The string could be broken across text runs for any of the following reasons:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">part of the word is formatted differently (eg in bold)</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">spelling/grammar</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">editing order (rsid)</span></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">This is one reason that using data bound content controls is often a better approach (see next section).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Subject to that, you can do text substitution in a variety of ways, for example:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">traversing the main document part, and looking at the </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';white-space:pre-wrap;">org.docx4j.wml.Text </span><span style="font-family: 'Calibri Light';">objects</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">marshal to a string, search/replace in that, then unmarshall again </span></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">docx4j</span><span class="" style="">‘</span><span class="" style="font-family: 'Calibri Light';">s XmlUtils also contains:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">     </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">/**</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">     </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">* Give a string of wml containing ${key1}, ${key2}, return a suitable</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">     </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">* object.*/</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">public static </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">Object unmarshallFromTemplate(String wmlTemplateString, </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">        </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">java.util.HashMap&lt;String, String&gt; mappings) </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><br /></span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">See the UnmarshallFromTemplate example, which operates on a string containing:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="font-size: 12.0pt;">   </span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Hack Regular';">&lt;w:p&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;w:r&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">         <span class="" style="font-family: 'Hack Regular';">&lt;w:t&gt;</span></span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">My favourite colour is </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';">${colour}</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';">.</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Hack Regular';">&lt;</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Hack Regular';">w:t&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Hack Regular';">w:r&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">   <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Hack Regular';">w:p&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">   <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">&lt;w:p </span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">   <span class="" style="font-family: 'Hack Regular';">&lt;w:p&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;w:r&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">         <span class="" style="font-family: 'Hack Regular';">&lt;w:t&gt;</span></span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">My favourite ice cream is </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';">${icecream}</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 10.0pt;;font-family: 'Hack Regular';">.</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Hack Regular';">&lt;</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Hack Regular';">w:t&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">      <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Hack Regular';">w:r&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;">   <span class="" style="font-family: 'Hack Regular';">&lt;</span></span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 10.0pt;;font-family: 'Hack Regular';">/</span><span class="DefaultParagraphFont " style="color: #800000;font-size: 10.0pt;;font-family: 'Hack Regular';">w:p&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591857" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Text substitution via data bound content controls</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">If you have an XML file containing your own data, WordML has a mechansim for associating entries in that XML with content controls in the document.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Then, when you open the document in Word 2007, Word automatically populates the content controls with the relevant XML data, which could even be an image (or with docx4j, arbitrary XHTML)</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">.  (This approach supersedes Word's legacy mail merge fields.  Simple VBA for migrating a document is available at </span><a href="http://blogs.msdn.com/b/microsoft_office_word/archive/2007/03/28/migrating-mail-merge-fields-to-content-controls.aspx"><span class="Hyperlink DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">http://blogs.msdn.com/b/microsoft_office_word/archive/2007/03/28/migrating-mail-merge-fields-to-content-controls.aspx</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> )</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">This works using XPath.  A data-bound content control looks something like:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">      </span><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">&lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Hack Regular';">w:sdt</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">        &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Hack Regular';">w:sdtPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">          &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Hack Regular';">w:dataBinding</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 7.5pt;;font-family: 'Hack Regular';">w:xpath</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">=</span><span class="DefaultParagraphFont " style="font-size: 7.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">/root[1]/customer[1]</span><span class="DefaultParagraphFont " style="font-size: 7.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 7.5pt;;font-family: 'Hack Regular';">w:storeItemID</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">=</span><span class="DefaultParagraphFont " style="font-size: 7.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">{428C88D8-C0E3-44F0-B5D7-F65D8B9F7EC9}</span><span class="DefaultParagraphFont " style="font-size: 7.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> /&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">        &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Hack Regular';">w:sdtPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">        &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Hack Regular';">w:sdtContent</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">          &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Hack Regular';">w:r</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">            &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Hack Regular';">w:rPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">              &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Hack Regular';">w:rStyle</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #FF0000;font-size: 7.5pt;;font-family: 'Hack Regular';">w:val</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">=</span><span class="DefaultParagraphFont " style="font-size: 7.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">PlaceholderText</span><span class="DefaultParagraphFont " style="font-size: 7.5pt;;font-family: 'Hack Regular';">"</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> /&gt;</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">            &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Hack Regular';">w:rPr</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">            &lt;</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Hack Regular';">w:t</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">&gt;</span><span class="DefaultParagraphFont " style="font-size: 7.5pt;;font-family: 'Hack Regular';">Click here to enter text.</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">&lt;/</span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Hack Regular';">w:t</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">          &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Hack Regular';">w:r</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">        &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Hack Regular';">w:sdtContent</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">      &lt;/</span></span><span class="DefaultParagraphFont " style="color: #A31515;font-size: 7.5pt;;font-family: 'Hack Regular';">w:sdt</span><span class="DefaultParagraphFont " style="color: #0000FF;font-size: 7.5pt;;font-family: 'Hack Regular';">&gt;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">You XML file is stored as a part in the docx, typically with a path which is something like customXml/item1.xml.   Note: despite the word "customXml" in the path, this functionality is not affected by the 2009 i4i patent saga.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">If you have a Word document which contains data-bound content controls and your data, docx4j can fetch the data, and place it in the relevant content controls.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">This is useful if you don't want to leave it to Word to do that (for example, you are creating PDFs with docx4j).</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Your XML is represented using 2 parts:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">CustomXmlDataStoragePart customXmlDataStoragePart </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">= wordMLPackage.getCustomXmlDataStorageParts().get(itemId);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">CustomXmlDataStorage customXmlDataStorage </span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         <span class="" style="font-family: 'Hack Regular';">= customXmlDataStoragePart.getData();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">To apply the bindings:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">      <span class="" style="font-family: 'Hack Regular';">customXmlDataStoragePart.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 8.0pt;;font-family: 'Hack Regular';">applyBindings</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">(wordMLPackage.getMainDocumentPart());</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">See further the CustomXmlBinding sample. </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">If you want to create the same document 5 times, each populated with different data, obviously you'd need to insert new XML data first.</span></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc96591858" /><span style="font-family: 'Liberation Serif';">Binding extensions for repeats and conditionals</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">A content control is </span><span class="DefaultParagraphFont " style="font-style: italic;;font-family: 'Calibri Light';">conditional</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> if it (and its contents) are included/excluded from the document based on whether some condition is true or false.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">A content control is a </span><span class="DefaultParagraphFont " style="font-style: italic;;font-family: 'Calibri Light';">repeat</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> if it designates that its contents are to be included more than once.  For example, a row of a table for each invoice/order item, or person.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">docx4j contains a mechanism for processing conditional content controls and repeats.  See </span><a href="http://www.opendope.org/opendope_conventions_v2.3.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">http://www.opendope.org/opendope_conventions_v2.3.html</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> for an explanation.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">See also the docx4j sample ContentControlBindingExtensions.</span></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc96591859" /><span style="font-family: 'Liberation Serif';">Binding escaped XHTML (XML + CSS)</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">docx4j can also take encoded XHTML and convert this to docx content.</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> See further OpenDoPE_XHTML.docx in the docx4j docs directory.</span></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc96591860" /><span style="font-family: 'Liberation Serif';">Binding other rich content</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">docx4j can take docx content (stored in an XML element as escaped Flat OPC XML) and convert this to docx content. </span></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc96591861" /><span style="font-family: 'Liberation Serif';">Authoring</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">To set up the bindings, you can use one of the Word Add-In from </span><a href="http://www.opendope.org/implementations.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">http://www.opendope.org/implementations.html</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">  Please note that you will need to install .NET Framework 4.0 ("full" - the "client profile" is not enough).</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591862" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Mailmerge</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">docx4j has quite good support for processing fields of type MERGEFIELD (ie the equivalent of doing a mailmerge operation from within Microsoft Word).</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591863" /><span style="font-family: 'Liberation Serif';">SmartArt</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">docx4j supports reading docx and pptx files which contain SmartArt.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">From docx4j 2.7.0, you can also generate SmartArt.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">To do this, you need:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">the layout definition for the SmartArt, either in the docx already, or from a glox file </span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">an XML file specifying the list of text items you want to render graphically</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">an XSLT which can convert a transformed version of that XML file into a SmartArt data file.</span></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Docx4j can be used to insert the SmartArt parts into a docx; Word or Powerpoint will then render it when the document is opened.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">The code can be found in:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">org.opendope.SmartArt.dataHierarchy</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">org.docx4j.openpackaging.parts.DrawingML, and</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">src/glox4j/java</span></li></ul>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591864" /><span style="font-family: 'Liberation Serif';">JAXB stuff</span></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc96591865" /><span style="font-family: 'Liberation Serif';">Cloning</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">To clone a JAXB object, use one of the following methods in XmlUtils:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">/** Clone this JAXB object, using default JAXBContext. */ </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">public static </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">&lt;T&gt; T deepCopy(T value) </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">  </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">/** Clone this JAXB object */</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">public static </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">&lt;T&gt; T deepCopy(T value, JAXBContext jc) </span></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Ref273527051" /><a name="_Toc96591866" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">javax.xml.bind.JAXBElement</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">One annoying thing about JAXB, is that an object </span><span class="" style="">– </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">say a table </span><span class="" style="">– </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">could be represented as </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.wml.Tbl</span><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">(as you would expect).  Or it might be wrapped in a </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">javax.xml.bind.JAXBElement</span><span class="" style="font-family: 'Calibri Light';">, in which case to get the real table, you have to do something like:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">     </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">if </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">( ((JAXBElement)o).getDeclaredType().getName().equals(</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Hack Regular';">"org.docx4j.wml.Tbl"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">) ) </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">          </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.wml.Tbl tbl = (org.docx4j.wml.Tbl)((JAXBElement)o).getValue();</span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">XmlUtils.</span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Calibri Light';">unwrap</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> can do this for you.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Be careful, though.  If you are intend to copy an unwrapped object into your document (rather than just read it), you'll probably want the object to remain wrapped (JAXB usually wraps them for a reason; without the wrapper, you might find you need an @XmlRootElement annotation in order to be able to marshall ie save your document).</span></p>
  
  <p class="Heading2 Normal DocDefaults "><a name="_Toc96591867" /><span style="font-family: 'Liberation Serif';">@XmlRootElement</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Most commonly used objects have an </span><span class="DefaultParagraphFont " style="font-weight: bold;;font-family: 'Hack Regular';white-space:pre-wrap;">@XmlRootElement </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">annotation, so they can be marshalled and unmarshalled.  </span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">In some cases, you might find this annotation is missing.  </span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">If you can't add the annotation to the jaxb source code, an alternative is to </span><span class="DefaultParagraphFont " style="text-decoration: underline;;font-family: 'Calibri Light';">marshall</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> it using code which is explicit about the resulting QName.  For example, XmlUtils contains:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">/** Marshal to a W3C document, for object</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">   </span><span class="DefaultParagraphFont " style="color: #3F5FBF;font-size: 9.0pt;;font-family: 'Hack Regular';">*  missing an @XmlRootElement annotation.  */</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">  </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">public static </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">org.w3c.dom.Document marshaltoW3CDomDocument(Object o, JAXBContext jc,</span><span class="DefaultParagraphFont " style="font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">      </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">String uri, String local, Class declaredType) </span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">You could use this like so:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">CTFootnotes footnotes = </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><br /></span><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">        </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">wmlPackage.getMainDocumentPart().getFootnotesPart().getJaxbElement().getValue();</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">CTFtnEdn ftn = footnotes.getFootnote().get(1);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">// No @XmlRootElement on CTFtnEdn, so .. </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">Document d = XmlUtils.marshaltoW3CDomDocument( ftn,</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #FFFFFF;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">        </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">Context.jc, Namespaces.NS_WORD12, </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 9.0pt;;font-family: 'Hack Regular';">"footnote"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">,  CTFtnEdn.</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 9.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">class </span><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;;font-family: 'Hack Regular';">);</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';white-space:pre-wrap;">Where the problematic object is something you're adding which isn't at the top of the tree, you should add it wrapped in a JAXBElement.  For example, suppose you wanted to add </span><span class="DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">FldChar fldchar.  You'd create it in the ordinary way:</span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 9.0pt;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">    </span><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;">FldChar fldchar = factory.createFldChar();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="apple-style-span DefaultParagraphFont " style="color: #000000;;font-family: 'Calibri Light';">but then what you'd actually add to r.getRunContent() is:</span><span class="DefaultParagraphFont " style="color: #000000;">   </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">new</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> JAXBElement( </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">new</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Liberation Mono';white-space:pre-wrap;"> QName(Namespaces.</span></span><span class="DefaultParagraphFont " style="color: #0000C0;font-style: italic;font-size: 8.0pt;;font-family: 'Liberation Mono';">NS_WORD12</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;">, </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Liberation Mono';">"fldChar"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Liberation Mono';">), FldChar.</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Liberation Mono';">class</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Liberation Mono';">, fldchar);</span><span class="apple-style-span DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Liberation Mono';white-space:pre-wrap;"> </span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';">An easier way to do this is to find the appropriate method in the object factory (ie the method for creating it wrapped as a JAXBElement).  Use that method signature.  In this example:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="color: #646464;font-size: 8.0pt;;font-family: 'Hack Regular';">@XmlElementDecl</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">(namespace = </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">"http://schemas.openxmlformats.org/wordprocessingml/2006/main"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">, name = </span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">"fldChar"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">, scope = R.</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">class</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">)</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">    </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">public</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> JAXBElement&lt;FldChar&gt; createRFldChar(FldChar value) {</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">        </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">return</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">new</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> JAXBElement&lt;FldChar&gt;(</span></span><span class="DefaultParagraphFont " style="color: #0000C0;font-style: italic;font-size: 8.0pt;;font-family: 'Hack Regular';">_RFldChar_QNAME</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">, FldChar.</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">class</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">, R.</span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">class</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">, value);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">    }</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-top: 0.07in;margin-bottom: 0.07in;line-height: 100%;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">The easiest way is to use the </span><a href="http://webapp.docx4java.org/OnlineDemo/PartsList.html"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">PartsList </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">online </span><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">webapp</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> to generate the relevant code.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591868" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Merging Documents and Presentations</span></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';">As</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';"> </span><a href="http://blogs.msdn.com/b/ericwhite/archive/2008/11/03/inserting-deleting-moving-paragraphs-in-open-xml-wordprocessing-documents.aspx"><span class="Hyperlink DefaultParagraphFont " style="color: #AD582A;font-size: 11.0pt;"><span class="" style="font-family: 'Calibri Light';">Eric White</span><span class="" style="">’</span><span class="" style="font-family: 'Calibri Light';">s blog explained</span></span></a><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';" /><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';">, combining multiple documents can be complicated:</span></p>
  
  <p class="NormalWeb Normal DocDefaults " style="position: relative; margin-left: 0.5in;"><span class="DefaultParagraphFont " style="color: #777777;font-size: 11.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">This programming task is complicated by the need to keep other parts of the document in sync with the data stored in paragraphs. For example, a paragraph can contain a reference to a comment in the comments part, and if there is a problem with this reference, the </span><span class="DefaultParagraphFont " style="color: #777777;font-size: 11.0pt;;font-family: 'Calibri Light';">document is invalid. You must take care when moving / inserting / deleting paragraphs to maintain ‘</span><span class="Emphasis DefaultParagraphFont " style="font-weight: bold;color: #777777;font-size: 11.0pt;;font-family: 'Calibri Light';">referential integrity</span><span class="DefaultParagraphFont " style="color: #777777;font-size: 11.0pt;;font-family: 'Calibri Light';">’ within the document.</span></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';">Plutext’s Enterprise edition of docx4j includes “MergeDocx” code  which makes merging documents as easy as invoking the method:</span></p>
  
  <p class="Normal DocDefaults "><span class="HTMLCode DefaultParagraphFont " style="font-size: 8.0pt;">   <span class="" style="font-family: 'Hack Regular';">public</span></span><span class="DefaultParagraphFont " style="font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">  </span></span><span class="HTMLCode DefaultParagraphFont " style="font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';">WordprocessingMLPackage merge(List&lt;WordprocessingMLPackage&gt; wmlPkgs)</span></span></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';">In other words, you pass a list of docx, and get a single new docx back.</span></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">To try it, visit </span><a href="http://webapp.docx4java.org/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">http://webapp.docx4java.org/</span></a><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">The commercial edition of docx4j includes </span><span class="DefaultParagraphFont " style="font-size: 11.0pt;;font-family: 'Calibri Light';">MergePptx, which you can use to concatenate presentations.</span></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;">The MergeDocx extension can also be used to process a </span><span class="DefaultParagraphFont " style="font-weight: bold;color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';">docx</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';white-space:pre-wrap;"> which is embedded as an</span><span class="apple-converted-space DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';"> </span><span class="Strong DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';">altChunk</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';">.  (Without the extension, you have to rely on Word to convert the altChunk to normal content, which means if your docx contains w:altChunk, you have to round trip it through Word, before docx4j can create a PDF or HTML out of it.)</span></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';">To process the w:altChunk elements in a docx, you invoke:</span></p>
  
  <p class="Normal DocDefaults "><span class="HTMLCode DefaultParagraphFont " style="font-size: 8.0pt;">   <span class="" style="font-family: 'Hack Regular';">public</span></span><span class="DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="HTMLCode DefaultParagraphFont " style="font-size: 8.0pt;;font-family: 'Hack Regular';">WordprocessingMLPackage process(WordprocessingMLPackage srcPackage)</span></p>
  
  <p class="NormalWeb Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 11.0pt;;font-family: 'Calibri Light';">You pass in a docx containg altChunks, and get a  new docx back which doesn’t.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591869" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Other Support Options</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">If the free community support available in the docx4j forum does not meet your needs, or you simply want to outsource some coding, you are welcome to purchase programming, consulting </span><span class="" style="font-family: 'Calibri Light';">or</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> priority support from </span><a href="http://www.plutext.com/m/index.php/services"><span class="Hyperlink DefaultParagraphFont " style="font-size: 10.0pt;;font-family: 'Liberation Sans';">Plutext</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">By purchasing services from Plutext, you support the continued development of docx4j.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591870" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Colophon</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">This document was written in Microsoft </span><span class="" style="font-family: 'Calibri Light';">Word, using:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">XML pretty printed using </span><a href="http://www.softlion.com/webTools/XmlPrettyPrint/default.aspx"><span class="DefaultParagraphFont " style="color: #0000FF;text-decoration: underline;;font-family: 'Calibri Light';">http://www.softlion.com/webTools/XmlPrettyPrint/default.aspx</span></a><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">or Package Explorer</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';white-space:pre-wrap;">Java source code formatted using </span><a href="http://www.java2html.de"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">http://www.java2html.de</span></a><span style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span style="font-family: 'Calibri Light';white-space:pre-wrap;">(or cut/pasted from Eclipse)</span></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">The HTML version was </span><span class="" style="font-family: 'Calibri Light';">generated using docx4j.</span></p>
  
  <p class="Heading1 Normal DocDefaults "><a name="_Toc96591871" /><span class="DefaultParagraphFont " style="font-family: 'Liberation Serif';">Contacting Plutext</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Unless you have paid for support, general </span><span class="" style="">“</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">How do I</span><span class="" style="">” </span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">type questions should be posted directly to the </span><a href="http://www.docx4java.org/forums/"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">docx4j forum</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> or StackOverflow.  Plutext may post to the forum any questions it receives by email which should have been directed to the forum.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Plutext can be contacted at either </span><a href="mailto:jason@plutext.org"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">jason@plutext.org</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">, or </span><a href="mailto:jharrop@plutext.com"><span class="Hyperlink DefaultParagraphFont " style="font-family: 'Calibri Light';">jharrop@plutext.com</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="Normal DocDefaults " style="page-break-before: always;"> </p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults " style="text-align: center;"><span class="DefaultParagraphFont " style="font-weight: bold;text-decoration: underline;;font-family: 'Calibri Light';white-space:pre-wrap;">Appendix </span><span class="DefaultParagraphFont " style="font-weight: bold;text-decoration: underline;;font-family: 'Calibri Light';">1</span><span class="DefaultParagraphFont " style="font-weight: bold;text-decoration: underline;"><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><span class="" style="">– </span></span><span class="DefaultParagraphFont " style="font-weight: bold;text-decoration: underline;;font-family: 'Calibri Light';">Font Mapping</span></p>
  
  <p class="Normal DocDefaults " style="border-left-style: solid;border-left-width: 1px;border-left-color: #000000;border-right-style: solid;border-right-width: 1px;border-right-color: #000000;border-color: #FFFF00; border-style:solid; border-width:1px;background-color: #FFFF00;"><span class="" style="font-family: 'Calibri Light';">This section is</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> most relevant for PDF output via XSL FO </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">docx4j can only use fonts which are available to it.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">These fonts come from 2 sources:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">those installed on the computer</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">those embedded in the document</span></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">Note that Word silently performs </span><span class="DefaultParagraphFont " style="font-weight: bold;font-style: italic;;font-family: 'Calibri Light';">font substitution</span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">.  When you open an existing document in Word, and select text in a particular font, the actual font you see on the screen won't be the font reported in the ribbon if it is not installed on your computer or embedded in the document.  To see whether Word 2007 is substituting a font, go into Word Options &gt; Advanced &gt; Show Document Content and press the "Font Substitution" button.  </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">Word's font substitution information is not available to docx4j.  As a developer, you 3 options:</span></p><ul>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">ensure the font is installed or embedded</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">tell docx4j which font to use instead, or</span></li>
  
  <li class="ListParagraph Normal DocDefaults " style="display: list-item;"><span style="font-family: 'Calibri Light';">allow docx4j to fallback to a default font</span></li></ul>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">To embed a font in a document, open it in Word on a computer which has the font installed (check no substitution is occuring), and go to Word Options &gt; Save &gt; Embed Fonts in File.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">If you want to tell docx4j to use a different font, you need to add a font mapping.  The FontMapper interface is used to do this.</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">On a Windows computer, font names for installed fonts are mapped 1:1 to the corresponding physical fonts via the IdentityPlusMapper. </span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">A font mapper contains Map&lt;String, PhysicalFont&gt;; to add a font mapping, as per the example in the ConvertOutPDF sample:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">// Set up font </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">mapper</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">Mapper fontMapper = </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">new</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> IdentityPlusMapper();</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Hack Regular';">wordMLPackage.setFontMapper(fontMapper);</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">         </span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">// Example of mapping missing font Algerian to installed font Comic </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Sans</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> MS</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Hack Regular';">PhysicalFont font = PhysicalFonts.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 8.0pt;;font-family: 'Hack Regular';">getPhysicalFonts</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">().get(</span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">"Comic Sans MS"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">);</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Hack Regular';">fontMapper.getFontMappings().put(</span></span><span class="DefaultParagraphFont " style="color: #2A00FF;font-size: 8.0pt;;font-family: 'Hack Regular';">"Algerian"</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">, font);</span></p>
  
  <p class="Normal DocDefaults "> </p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;">You'll see the font names if you configure log4j debug level logging for </span><span class="DefaultParagraphFont " style="font-weight: bold;font-size: 9.0pt;;font-family: 'Hack Regular';">org.docx4j.fonts.PhysicalFonts</span></p>
  
  <p class="Normal DocDefaults "><span class="" style="font-family: 'Calibri Light';">To conserve resources, you can restrict to a subset of fonts installed on your system:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">// Font </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">regex</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> (optional)</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">// Set </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">regex</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> if you want to restrict to some defined subset of fonts</span></span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">// Here we have to do this before calling createContent,</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">// since that discovers fonts</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;">String regex = </span></span><span class="DefaultParagraphFont " style="font-weight: bold;color: #7F0055;font-size: 8.0pt;;font-family: 'Hack Regular';">null</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">;</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">// Windows:</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">// String</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 6.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">// </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Hack Regular';">regex</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Hack Regular';">=".*(</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Hack Regular';">calibri</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Hack Regular';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Hack Regular';">cour</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Hack Regular';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Hack Regular';">arial</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Hack Regular';">|times|comic|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Hack Regular';">georgia</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Hack Regular';">|impact|LSANS|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Hack Regular';">pala</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Hack Regular';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Hack Regular';">tahoma</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Hack Regular';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Hack Regular';">trebuc</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Hack Regular';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Hack Regular';">verdana</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Hack Regular';">|symbol|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Hack Regular';">webdings</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Hack Regular';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;text-decoration: underline;;font-family: 'Hack Regular';">wingding</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 6.0pt;;font-family: 'Hack Regular';">).*";</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">// </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Mac</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">// String</span></p>
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">// </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">regex</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">=".*(Courier New|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Arial</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">|Times New Roman|Comic </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Sans</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Georgia</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">|Impact|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Lucida</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;"><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> Console|</span></span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Lucida</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Sans</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Unicode</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Palatino</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Linotype</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Tahoma</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Trebuchet</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Verdana</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">|Symbol|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Webdings</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">|</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Wingdings</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">|MS </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Sans</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Serif</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';white-space:pre-wrap;">|MS </span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;text-decoration: underline;;font-family: 'Hack Regular';">Serif</span><span class="DefaultParagraphFont " style="color: #3F7F5F;font-size: 8.0pt;;font-family: 'Hack Regular';">).*";</span></p>
  
  <p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;">   <span class="" style="font-family: 'Hack Regular';">PhysicalFonts.</span></span><span class="DefaultParagraphFont " style="color: #000000;font-style: italic;font-size: 8.0pt;;font-family: 'Hack Regular';">setRegex</span><span class="DefaultParagraphFont " style="color: #000000;font-size: 8.0pt;;font-family: 'Hack Regular';">(regex);</span><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> </span></p>
  
  <p class="Normal DocDefaults "> </p></div>
  
  <div class="footnotes">
  
  <p class="Normal DocDefaults " style="margin-bottom: 0in;line-height: 100%;"> </p>
  
  <p class="FootnoteText Normal DocDefaults "><span class="FootnoteReference DefaultParagraphFont " style="vertical-align: top; font-size: xx-small"><a name="fn1"><a href="#fs1">1</a></a></span><span class="" style="font-family: 'Hack Regular';white-space:pre-wrap;"> </span><span class="" style="font-family: 'Calibri Light';">IBM has their own proprietary JAXB implementation.  By default, WebSphere uses com.ibm.xml.xlxp2.jaxb, which has the concept of fallback/ MarshallerProxy.  The actual implementation it uses is in com.ibm.jaxb.tools.jar.</span></p>
  
  <p class="FootnoteText Normal DocDefaults "><span class="FootnoteReference DefaultParagraphFont " style="vertical-align: top; font-size: xx-small"><a name="fn2"><a href="#fs2">2</a></a></span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> If you get the error 'Access restriction: The type</span><span class="apple-converted-space DefaultParagraphFont " style="font-family: 'Calibri Light';"> </span><span class="underline DefaultParagraphFont " style="font-family: 'Calibri Light';white-space:pre-wrap;">is not accessible due to restriction on required library rt.jar' (perhaps using some combination of Eclipse 3.4 and/or JDK 6 update 10?), you need to go into the Build Path for the project, Libraries tab, select the JRE System Library, and add an access rule, "Accessible, **". </span></p>
  
  <p class="FootnoteText Normal DocDefaults "><span class="FootnoteReference DefaultParagraphFont " style="vertical-align: top; font-size: xx-small"><a name="fn3"><a href="#fs3">3</a></a></span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><a href="#null"><span class="Hyperlink DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">http://blogs.msdn.com/b/dmahugh/archive/2009/01/16/ecma-376-implementation-notes-for-office-2007-sp2.aspx</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p>
  
  <p class="FootnoteText Normal DocDefaults "><span class="FootnoteReference DefaultParagraphFont " style="vertical-align: top; font-size: xx-small"><a name="fn4"><a href="#fs4">4</a></a></span><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;"> </span><a href="#null"><span class="Hyperlink DefaultParagraphFont " style="font-size: 9.0pt;;font-family: 'Calibri Light';">http://blogs.msdn.com/b/dmahugh/archive/2010/04/06/office-s-support-for-iso-iec-29500-strict.aspx</span></a><span class="" style="font-family: 'Calibri Light';white-space:pre-wrap;" /></p></div>
  
  
  
  
  
  <!-- userBodyTail goes here -->
  
  </body></html>